0

I'm trying to understand roughly how boost's adjacency_list works, and don't understand how edge descriptors can remain valid after remove_edge is called when using an EdgeList of std::vector.

As far as I understand it, both vertex and edge descriptors are indexes into the adjacency list's central vertex and edge storage (also each a std::vector). When an edge is removed, shouldn't this invalidate the descriptor (index) of all edges after the one removed in the storage? Or at least that of the edge that was moved from the end to fill the gap?

zennehoy
  • 6,405
  • 28
  • 55

1 Answers1

0

Partial answer here:

performing remove_edge(u, v, g) will always invalidate any edge descriptor for (u,v) or edge iterator pointing to (u,v), regardless of the kind adjacency_list. In this discussion of iterator and descriptor invalidation, we are only concerned with the affect of remove_edge(u, v, g) on edge descriptors and iterators that point to other edges (not (u,v)).

boost adjacency iterator invalidation

More info on the original documentation.

Kirell
  • 9,228
  • 4
  • 46
  • 61
  • Yes, that is the table I'm confused by. Neither vertex nor edge descriptors are invalidated by `remove_edge`. `remove_vertex` invalidates everything as expected. – zennehoy Jul 30 '15 at 14:57
  • I found the related section in the doc. My guess is that others edge indices are swapped to be coherent. I am not sure though. – Kirell Jul 30 '15 at 15:18