Boost logo

Boost Users :

Subject: [Boost-users] [Graph] Descriptor invalidation on remove_vertex() with adjacency_list VL=vecS
From: Chris Dellin (cdellin_at_[hidden])
Date: 2015-08-13 17:59:45


Hello,

The documentation for the adjacency_list [0] is clear that if the vertex
list container is vecS, then calling remove_vertex() will invalidate any
vertex/edge descriptors into the graph.

However, I was wondering if this is actually the case if the removed vertex
was the one most recently added, that is,
remove_vertex(vertex(num_vertices(g)-1)). In this case, I would think that
no shifting of vertex data or adjustment of edge source/target indices
would be necessary, and existing descriptors are guaranteed to be still
valid.

Is this safe to do with the current implementation? If not, why not?

Thanks,
- Chris Dellin

[0] http://www.boost.org/doc/libs/1_59_0/libs/graph/doc/adjacency_list.html



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