Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2003-08-11 19:53:26


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net