BGL write_graphviz and VertexList type
Hello, I've been trying to use the write_graphviz function in BGL, and I've noticed that it appears to be sensitive to the type of VertexList used in the graph. adjacency_lists using a boost::vecS produce vertex indices in integer form like: graph G { 0[label="0"]; 1[label="1"]; 0--1 [label="2.8"]; } but the same code backed by boost::listS seems to not dereference completely: graph G { 0x80545f0[label="10"]; 0x8054608[label="11"]; 0x80545f0--0x8054608 [label="2.8"]; } dot doesn't like this. I notice that write_graphviz dereferences boost::graph_traits<Graph>::vertex_iterator to print the vertex. Are the listS and vecS *operators different somehow? The vector backed adjacency_list also seems to be automagically setting the vertex_index property to the actual index of the vertex in the storage vector instead of the value given in add_vertex(). My question is: Is this the expected behavior for these classes or some problem I've managed to create on my own? Thanks, Solomon
Hi Solomon, On Monday, August 11, 2003, at 07:02 PM, Solomon Gibbs wrote:
Hello,
I've been trying to use the write_graphviz function in BGL, and I've noticed that it appears to be sensitive to the type of VertexList used in the graph.
Yeah, it looks like we never got around to handling the printing of vertex indices in a generic fashion. We just print the vertex_descriptor. For vecS this works nicely, since the vertex_descriptor happens to also be the vertex index, but for listS the vertex_descriptor is a pointer, hence the addresses in the dot file.
adjacency_lists using a boost::vecS produce vertex indices in integer form like: graph G { 0[label="0"]; 1[label="1"]; 0--1 [label="2.8"]; }
but the same code backed by boost::listS seems to not dereference completely: graph G { 0x80545f0[label="10"]; 0x8054608[label="11"]; 0x80545f0--0x8054608 [label="2.8"]; } dot doesn't like this.
I notice that write_graphviz dereferences boost::graph_traits<Graph>::vertex_iterator to print the vertex. Are the listS and vecS *operators different somehow?
No, but the vertex_descriptor's are different, as explained above.
The vector backed adjacency_list also seems to be automagically setting the vertex_index property to the actual index of the vertex in the storage vector instead of the value given in add_vertex().
Yeah, that is a documented feature.
My question is: Is this the expected behavior for these classes or some problem I've managed to create on my own?
It is expected but lame behavior. I'll fix it. Cheers, Jeremy
participants (2)
-
Jeremy Siek
-
Solomon Gibbs