简体   繁体   English

在Python中使用Boost Graph库

[英]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, 嗨,我一直在看图库,它将允许我在PyQt QgraphicsScene上创建交互式图(有点像facebook / LinkedIn社交图),而我还没有发现很多与Qt / PyQt兼容的Python库(快速,有很多布局算法)我确实遇到过Boost Graph Library(BGL),这是一个C ++库,我想知道是否/如何从我的python代码中使用BGL,

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. 我想我可以将节点和边添加到BGL图形对象中,然后调用BGL的绘制图方法,据我所知将计算节点和边的位置/布局,并且可以将它们转换为点到我的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? 我的第一个问题是如何直接从我的Python代码中调用/使用BGL,(指向示例的指针会很棒)其次,还有另一个我可以使用的C ++库,该库既快速又健壮,并且可以与Python很好地兼容? Note: I am not really familiar with C++, and am running on Windows Thanks 注意:我不太熟悉C ++,并且在Windows上运行谢谢

First part of your question is about Python graph library. 问题的第一部分是关于Python图形库的。 It is discussed in depth here: Python Graph Library 在此进行深入讨论: Python图形库

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 . 在BGL中,它对应于“布局算法”的概念,请参见此处的第16章: 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 其他库只是隐藏了这些布局算法,并为您提供类似于graph_draw功能(来自graph-tool),请参见此处的示例http://graph-tool.skewed.de/static/doc/quickstart.html#creating-and-manipulating -graphs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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