[英]Creating a graph using Boost Graph library
I am new to graph theory and graph concept. 我是图论和图概念的新手。 I am workign on something, that requires me to create a mesh(Undirected graphs) with n number of nodes.
我正在做某事,这需要我创建一个具有n个节点的网格(无向图)。 Once the structure is created, I would be running various algorithms on the structure, to find a shortest path from a node to other.
创建结构后,我将在结构上运行各种算法,以找到从节点到另一节点的最短路径。 No for this I have decided to use Boost graph librabry.
为此,我决定使用Boost graph librabry。 I read through the online documentation.
我通读了在线文档。 The online documentation is good but at the same time not sufficient.
联机文档很好,但同时还不够。 I went through various examples online and everywhere, they import the graph from Graphviz.
我在网上和各处浏览了各种示例,他们从Graphviz导入图形。
If i am not wrong, we have to manually draw or write a dot program to get a graph in Graphviz and import in .dot format(Please correct me if i am wrong) 如果我没有记错,我们必须手动绘制或编写一个点程序以获取Graphviz中的图形并以.dot格式导入(如果我记错了,请纠正我)
But is there a way in Boost where I could create a graph, instead of importing it from GraphViz? 但是Boost中有一种方法可以创建图形,而不是从GraphViz导入图形吗? And I would let user to decide the number of vertices in it, instead of pre-defining it.
而且,我会让用户决定其中的顶点数量,而不是预先定义它。
Any help would be very much appreciated. 任何帮助将不胜感激。 Thanks a ton in advance.
在此先感谢一吨。
It's maybe not very correct, but I am giving a response a gave before. 这可能不是很正确,但是我之前已经给出了回应。
https://stackoverflow.com/a/3100220/202083 https://stackoverflow.com/a/3100220/202083
You can see how to programmaticaly add nodes and edges. 您可以看到如何以编程方式添加节点和边。
I hope this is enough for you to get started. 我希望这足以让您入门。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.