知识卡片

普通读书笔记卡 · 3649.a

BFS队列只含相邻两层

理解等级:中级

BFS 用先进先出队列维护当前搜索前沿;处理距离 k 的顶点时,新发现的顶点排在后面,距离为 k+1。因此队列中只会有相邻两层的部分顶点,而不会乱序跳到更远层。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第20章 基本图算法 · 查看原书依据

      Instead, it uses a single first-in, first-out queue (see Section 10.1.3) containing some vertices at a distance k, possibly followed by some vertices at distance k + 1. The queue, therefore, contains portions of two consecutive waves at any time.

    参考来源

    - 位置:《算法导论(第4版)》第20章《基本图算法》(OEBPS/chapter020.xhtml,文本字符[10000,15000))。 - 结论依据:原文说明单个FIFO队列中最多包含相邻两层的顶点。 - 原始内容:Instead, it uses a single first-in, first-out queue (see Section 10.1.3 ) containing some vertices at a distance k , possibly followed by some vertices at distance k + 1. The queue, therefore, contains portions of two consecutive waves at any time.