|
Boost Users : |
From: Doug Gregor (dgregor_at_[hidden])
Date: 2007-01-29 15:12:11
On Jan 29, 2007, at 2:38 PM, Adrian Boeing wrote:
> Hi Jens,
>
> Unfortunately it's all part of a larger program so I can't easily
> provide a small example.
>
> Yes, I am using the vecS storage:
> typedef
> boost::adjacency_list<boost::vecS,boost::vecS,boost::bidirectionalS,bo
> ost::property<vertex_prop_t,
> T>,boost::property<edge_prop_t, U>,boost::no_property, boost::listS >
> graph_type;
>
> I'm not sure how to remove the property descriptor, there does not
> seem
> to be a boost::remove(vertex prop,graph) that I can find anywhere.
Hmmm. So, when one removes a vertex from an adjacency_list with
VertexListS=vecS, it actually invalidates all of the existing vertex
descriptors. So simple code like the following causes problems:
graph_type::vertex_descriptor u = *vertices(g).first;
graph_type::vertex_descriptor v = *(++vertices(g).first);
clear_vertex(u, g);
remove_vertex(u, g);
adjacent_vertices(v, g); // v has been invalidated
vecS is a tricky beast. I usually recommend avoiding the removal of
vertices when VertexListS=vecS... it's inefficient and hard to use
properly.
Cheers,
Doug
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