简体   繁体   English

boost :: adjacency_list如何在remove_edge之后保持有效的边缘描述符

[英]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::vectorEdgeList调用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.

相关问题 带有 vecS 的 adjacency_list 上的`boost::edge()` 的运行时复杂度是多少? - What is the runtime complexity of `boost::edge()` on an adjacency_list with vecS? 增强图:add_edge和remove_edge线程安全吗? - Boost graph : Are add_edge and remove_edge thread safe? 使用boost :: adjacency_list的自定义边缘属性遍历边缘 - Iterating through edges with custom defined edge properties of boost::adjacency_list 从boost :: adjacency_list获取边缘属性(包括相关顶点) - Getting edge properties (including related vertices) from boost::adjacency_list 如何在boost :: adjacency_list中置换节点? - How to permute nodes in a boost::adjacency_list? Boost.Graph:保存和加载带有名称的boost :: adjacency_list - Boost.Graph: saving and loading a boost::adjacency_list with a name 有没有一种简单的方法来找出boost :: adjacency_list是否为空? - Is there a simple way to find out if a boost::adjacency_list is empty? 为什么使用 vecS 作为 OutEdgeList 模板参数的 boost adjacency_list 在遍历时使边无效? - Why does a boost adjacency_list using vecS as OutEdgeList template parameter invalidate edges on traversal? 从boost :: adjacency_list图中删除多个顶点 - Removing multiple vertices from a boost::adjacency_list graph 交换两个 boost::adjacency_list 图,类似于 std::swap - Swapping two boost::adjacency_list graphs, akin to std::swap
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM