|
Boost : |
From: Doug Gregor (dgregor_at_[hidden])
Date: 2004-11-24 11:11:33
On Nov 21, 2004, at 4:47 AM, Eyal Farago wrote:
> adjacency_list documentations refers to 'stability' problems of vertex
> descriptors and iterators.
> it also provides two wrong and one correct ways to remove all vertices
> from a graph, trying to use the 'correct' way produced an exception
> from within vector::erase. after looking into the state of the
> iterators I understand that the 'correct' example isn't correct at
> all, the iterators still refers to the original offsets in the
> vertices vector when the current vertex is erased from the graph. i.e.
> suppose the graph had 7 vertices to begin with and we've already
> erased the first one, the iterator to current (vi in the example)
> should point to offset 0 and the end iterator(vi_end in the example)
> should point to offset 6, instead we have iterators to offsets 1 and
> 7.
> am I right? if so, what is the correct way to do it?
The correct example only applies when the vertices are stored in a list
(i.e., VertexListS = listS), not when they are stored in a vector. If
you need to remove vertices, I'd strongly suggest that you use
VertexListS = listS.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk