[英]How does boost::adjacency_list keep valid edge descriptors after remove_edge
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
. 我试图大致了解boost的
adjacency_list
工作原理,并且不了解使用std::vector
的EdgeList
调用remove_edge
后边缘描述符如何保持有效。
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
). 据我了解,顶点和边缘描述符都是邻接表中央顶点和边缘存储(也都是
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?
或至少是从末端移开以填补空白的那条边缘?
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.
执行remove_edge(u,v,g)将始终使(u,v)或指向(u,v)的边缘迭代器的任何边缘描述符无效,而不管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)).
在对迭代器和描述符无效的讨论中,我们仅关注remove_edge(u,v,g)对边缘描述符和指向其他边缘(而不是(u,v))的迭代器的影响。
More info on the original documentation . 有关原始文档的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.