boost graph library - minimal example of vertex colors and graphviz output

前端 未结 1 884
心在旅途
心在旅途 2021-01-18 05:33

Being new to the boost graph library, I find it\'s often difficult to tease out what pieces of the examples are tied to the particular example and which parts are universal

1条回答
  •  清歌不尽
    2021-01-18 05:50

    Try:

    boost::dynamic_properties dp;
    dp.property("color", get(&vertex_info::color, g));
    dp.property("node_id", get(boost::vertex_index, g));
    write_graphviz_dp(outf, g, dp);
    

    instead of your write_graphviz call. See http://www.boost.org/doc/libs/1_47_0/libs/graph/example/graphviz.cpp for an example of this. Note that the code I posted will write out the colors as integers, not color names like Dot requires.

    0 讨论(0)
提交回复
热议问题