Boost logo

Boost Users :

From: Abhijit Deshmukh (abhijit.deshmukh_at_[hidden])
Date: 2005-07-12 10:29:15


Hi,

The clear() function did the trick for me. I am using vecS for
OutEdgeList and VertexList.
I guess using listS would have been better in this case. The list
would not have caused the iterator problem.

Thanks for your help.

Regards,
Abhijit Deshmukh

On 7/12/05, Jeremy Graham Siek <jsiek_at_[hidden]> wrote:
> 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
> invalidation
> 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()"
>
> Yep.
>
> Cheers,
> Jeremy
> _______________________________________________
> Jeremy Siek <jsiek_at_[hidden]>
> http://www.osl.iu.edu/~jsiek
> Ph.D. Candidate, Indiana University Bloomington
> C++ Booster (http://www.boost.org)
> _______________________________________________
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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