Search code examples
c++graphplotvisualizationboost-graph

Graph visualization (boost graph)


I have C++ program using boost graph library. I wonder if there is any way to visualize the graph (nodes and optionally edges) following a certain position values contained in nodes. Please look the examples of the image bellow to understand what I want to visualise: http://img11.hostingpics.net/pics/647608graphViz.png

Thanks.


Solution

  • You're in luck.

    Boost graph can serialize to and deserialize from the dot language (which is the language used by GraphViz). There are several examples in the (free) Boost Graph Library book and on the site.

    See e.g.: http://www.boost.org/doc/libs/release/libs/graph/doc/write-graphviz.html

    If you take the output of the sample on the previous webpage and run

    dot -Tpng dot > test.png
    

    You'll get something like the following picture:

    enter image description here

    Here is a direct link to an example using dynamic properties