简体   繁体   中英

Using Boost Graph Library in Python

Hi I have been looking at graph libraries that will allow me to create interactive graphs on PyQt QgraphicsScene,(kind of like facebook/LinkedIn social graphs) while I have not found many python libraries that work well with Qt/PyQt(fast, with numerous layout algorithms) I did come across Boost Graph Library(BGL), It is a C++ library I would like to know if/how I can make use of BGL from my python code,

I am thinking I can add nodes and edges to a BGL graph object, then call BGL's draw graph method this, to my understanding will calculate the positions/layout of the nodes and edges and I can translate these to points onto my QgraphicsScene. My first question is how can I call/make use of BGL directly from my Python code,(pointers to examples would be great) Secondly is there another C++ library that I can use, that is fast and robust and plays nice with Python? Note: I am not really familiar with C++, and am running on Windows Thanks

First part of your question is about Python graph library. It is discussed in depth here: Python Graph Library

Second question is about how to draw a graph.

In BGL it corresponds to the concept of "layout algorithms", see chapter 16 here: http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/table_of_contents.html .

Other libraries simply hide these layout algorithms and provide you with function similar to graph_draw (from graph-tool), see example here http://graph-tool.skewed.de/static/doc/quickstart.html#creating-and-manipulating-graphs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM