Boost logo

Boost Users :

From: Jeremy Graham Siek (jsiek_at_[hidden])
Date: 2005-07-12 08:52:23

Hi Guys,

On Jul 12, 2005, at 8:25 AM, Douglas Gregor wrote:
> The major problem here is that you shouldn't be dereferencing
> vertices(databaseGraph).second, because it is a past-the-end iterator.
> You could rewrite the loop as:
> while (vertices(databaseGraph).first != vertices(databaseGraph).second)
> {
> b = *vertices(databaseGraph).first;
> clear_vertex(b, databaseGraph);
> remove_vertex(b, databaseGraph);
> }

But the above loop could also have problems due to vertex iterator
caused by remove_vertex... it depends on the graph used.

>> Can you let me know what is the correct way of deleting all edges and
>> vertices in a mutable property undirected graph.
> The easy way is just "databaseGraph.clear()"


Jeremy Siek <jsiek_at_[hidden]>
Ph.D. Candidate, Indiana University Bloomington
C++ Booster (

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at