Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] vecS for vertex container and vertex index adjustments
From: Sergey Mitsyn (svm_at_[hidden])
Date: 2012-05-31 14:06:42


Hello,

Thanks for the reply!

>
> Yes, that should work. Rather than using vertices(graph).first +
> vi_index, use vertex(vi_index, graph);

I thought about that, but vertex(vi_index, graph) returns
vertex_descriptor, not vertex_iterator. Actually that works, but I think
it does so only because they have incidentally happened to be the
related types :).

> I believe the order is guaranteed
> to be the same between those, and it is in practice. You might also want
> to have the loop be over the vertex numbers:
>
> for (vertices_size_type i = 0; i < num_vertices(graph); /*Incremented in
> loop*/) {
> vertex_descriptor v = vertex(i, graph);
> if (condition(v, graph) {
> remove_vertex(v, graph);
> } else {
> ++i;
> }
> }

Yes, that would be much clearer, thanks!

-----------
Sergey Mitsyn.


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