简体   繁体   中英

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. 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. 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.

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)

But is there a way in Boost where I could create a graph, instead of importing it from 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

You can see how to programmaticaly add nodes and edges.

I hope this is enough for you to get started.

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