The strategy for doing that is to create a dynamic_properties object, add an
entry to it for the "style" edge property and some property map, and then
pass that to write_graphviz_dp. An example of what you want to do is in
libs/graph/example/graphviz.cpp; see how the "weight" property is handled.
In your case, the value type of the property would be std::string.
-- Jeremiah Willcock
Thanks Jeremiah,
Here is what I tried:
#include <iostream>
#include <string>
#include
#include
struct StyleProperty
{
std::string style;
}
typedef boost::undirected_graph Graph;
int main()
{
Graph g;
Graph::vertex_descriptor v0 = g.add_vertex();
Graph::vertex_descriptor v1 = g.add_vertex();
Graph::vertex_descriptor v2 = g.add_vertex();
StyleProperty styleInvisible;
styleInvisible.style = "invis";
StyleProperty styleNormal;
styleNormal = "normal";
boost::add_edge(v0,v1,styleInvisible, g);
boost::add_edge(v1,v2,styleNormal g);
boost::dynamic_properties dp;
dp.property("style", get(&StyleProperty::style, g));
boost::write_graphviz_dp(std::cout, g, dp, "style");
return 0;
}
However, I get an exception "dynamic property get cannot retrieve
value for property: style."
Can you see where I have gone wrong?
Thanks,
David