知识卡片
BFS队列等于灰色顶点集
BFS 循环检查时,队列中恰好是全部灰色顶点:发现白点时同时染灰并入队,取出顶点并处理完邻边后染黑。
这个不变量把“已发现但未处理完”的前沿状态与队列位置对齐。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第20章 基本图算法 · 查看原书依据
This while loop maintains the following invariant: At the test in line 10, the queue Q consists of the set of gray vertices.
参考来源
- 位置:《算法导论(第4版)》第20章《基本图算法》(OEBPS/chapter020.xhtml,文本字符[15000,20000))。
- 结论依据:原文明确while循环检查时队列与灰色顶点集合相等。
- 原始内容:This while loop maintains the following invariant: At the test in line 10, the queue Q consists of the set of gray vertices.