I am trying to use boost::dynamic properties to multiple properties to the Graphviz output.
I am familiar with custom property writer ( How to print a graph in graphviz with multiple properties displayed ), but I am trying to do the same thing with dynamic properties. How do we write the above edge property writer using the dynamic properties in the following code? I want to write if else statements on the values of the weight and capacity as in if(weight <5 && capacity <5) then color = red and so on.
boost::dynamic_properties dp/*(ignore_other_properties)*/;
dp.property("node_id", get(&vert::name, g));
dp.property("color", get(??,g));
write_graphviz_dp(std::cout, g, dp);
See some options here: map set/get requests into C++ class/structure changes
You can either transform the result of one property map, or you can use a functional property map altogether.
An example of using dynamic properties to transform a color property is here: Manually colouring of boost's graphs
function_property_map
as well boost dijkstra_shortest_paths: can't extract (or find?) the path (path contains a cycle) Note that you also have make_constant_property_map
(eg Boost Dynamic Properties with Custom get property )
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.