On Mon, 30 Sep 2013, Pablo Madoery wrote:
Hi, I have the following code that print a graph taking in count values of dynamic_properties:
#include<iostream> #include
#include using namespace std; using namespace boost;
struct VertexInfo { int id; };
struct EdgeInfo { double weight; bool enable; };
typedef adjacency_list
Graph; int main() { //////////////////////////////////////////////////////////////////////////////////////////// Graph graph; Graph::vertex_descriptor a = add_vertex(graph); Graph::vertex_descriptor b = add_vertex(graph); Graph::vertex_descriptor c = add_vertex(graph); Graph::vertex_descriptor d = add_vertex(graph); Graph::edge_descriptor e1 = (add_edge(a, b, graph)).first; Graph::edge_descriptor e2 = (add_edge(a, b, graph)).first; Graph::edge_descriptor e3 = (add_edge(b, c, graph)).first; Graph::edge_descriptor e4 = (add_edge(c, a, graph)).first; Graph::edge_descriptor e5 = (add_edge(c, a, graph)).first; Graph::edge_descriptor e6 = (add_edge(c, d, graph)).first;
graph[e1].weight = 5; graph[e2].weight = 10; graph[e3].weight = 6; graph[e4].weight = 14; graph[e5].weight = 2; graph[e6].weight = 3;
graph[e1].enable = true; graph[e2].enable = false; graph[e3].enable = true; graph[e4].enable = false; graph[e5].enable = true; graph[e6].enable = false;
ofstream ofs("graph.dot"); dynamic_properties dp; dp.property("node_id", get(vertex_index, graph)); dp.property("label", get(&EdgeInfo::weight, graph)); dp.property("taillabel", get(&EdgeInfo::enable, graph)); write_graphviz_dp(ofs, graph, dp);
cout << "fin" << endl;
return 0; }
///////////////////////////////////////////////////////////////////////////////////
there is a property called "enable" in the edges that I print in the tails of the arrows. But what i really want is that when enable = false the style of the arrow be different ("invis" for example). How can i do that?
Try something like this (not tested); be sure to include