Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-05-20 11:00:50


Hi Matt,

On Mon, 20 May 2002, Siegel, Matthew wrote:
> Please correct me if I'm wrong. It seems as if a vertex_index gets
> assigned to a vertex as it's added to the graph automatically.
> However, this doesn't seem to be the case for the edge_index.
>
> Is this correct??

That is mostly correct. The vertex_index gets assigned automatically
for adjacency_list with VertexList=vecS but not with VertexList=listS.
You are right about edge_index.

> I forsee the following problem. With the graph implemented using a
> std::vector for both the vertex list and the edge list, if a vertex is
> removed from the graph the index is corrected for the
> vertex_descriptor to the new, appropriate index. However, if an edge

Right. All vertices are re-indexed, so that after the removal the
remaining indices go from 0 to num_vertices-1

> is removed, the index for the edge_descriptor will not be corrected
> with the removal of an element in the vector. Also, this causes
> headaches when using an external property map. The edge index is
> linked directly to a location in my map.
>
> Any solutions for these problems??

The reason edge_index is not provided automatically is because it takes up
space (whereas the vertex_index is does not), and some users are concerned
about space issues.

Anyways, one possible solution is to somehow make it possible for you to
specify some code to be executed when an edge is added or removed from the
graph, and this code would adjust the edge indices, and perhaps the
external storage too. But before I get ahead of myself, could you describe
how you currently work around this problem, and perhaps how you'd like to
see it work?

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek http://www.osl.iu.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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