Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] Descriptor invalidation on remove_vertex() with adjacency_list VL=vecS
From: Marcin Zalewski (marcin.zalewski_at_[hidden])
Date: 2015-08-14 14:51:36


Since remove_vertex uses erase() under the hood, I think that it should be
safe to do with the current implementation.

On Thu, Aug 13, 2015 at 7:03 PM Chris Dellin <cdellin_at_[hidden]> wrote:

> 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 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