知识卡片

普通读书笔记卡 · 3650.a.3.a

DFS邻点颜色辅助判边

理解等级:中级

扫描边(u,v)时,

  • v 白色对应树边,
  • 灰色对应返祖边,
  • 黑色则是前向边或横叉边;

活动中的灰色顶点构成递归栈上的祖先链。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

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

      The key idea is that when an edge (u, v) is first explored, the color of vertex v says something about the edge: WHITE indicates a tree edge, GRAY indicates a back edge, and BLACK indicates a forward or cross edge. The first case is immediate from the specification of the algorithm. For the second case, observe that the gray vertices always form a linear chain of descendants corresponding to the stack of active DFS-VISIT invocations.

    参考来源

    - 位置:《算法导论(第4版)》第20章《基本图算法》(OEBPS/chapter020.xhtml,文本字符[40000,45000))。 - 结论依据:第20.3节以首次探索边时终点颜色区分:白对应树边、灰对应返祖边、黑对应前向或横叉;灰顶点按递归栈形成祖先链。 - 原始内容:The key idea is that when an edge ( u , v ) is first explored, the color of vertex v says something about the edge: WHITE indicates a tree edge, GRAY indicates a back edge, and BLACK indicates a forward or cross edge. The first case is immediate from the specification of the algorithm. For the second case, observe that the gray vertices always form a linear chain of descendants corresponding to the stack of active DFS-V ISIT invocations.