知识卡片
DFS递归调用映射树边
DFS 森林中的父子关系对应递归调用:在扫描 u 的邻接表时调用 DFS-VISIT(v),才有 v.π=u;v 在 u 为灰时被发现,才是 u 的后代。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第20章 基本图算法 · 查看原书依据
Perhaps the most basic property of depth-first search is that the predecessor subgraph Gπ does indeed form a forest of trees, since the structure of the depth-first trees exactly mirrors the structure of recursive calls of DFS-VISIT. That is, u = v.π if and only if DFS-VISIT(G, v) was called during a search of u’s adjacency list. Additionally, vertex v is a descendant of vertex u in the depth-first forest if and only if v is discovered during the time in which u is gray.
参考来源
- 位置:《算法导论(第4版)》第20章《基本图算法》(OEBPS/chapter020.xhtml,文本字符[35000,40000))。
- 结论依据:第20.3节指出DFS树恰映射递归调用结构:v.π=u当且仅当在扫描u邻接表时调用DFS-VISIT(v);灰色期发现对应后代。
- 原始内容:Perhaps the most basic property of depth-first search is that the predecessor subgraph G π does indeed form a forest of trees, since the structure of the depth-first trees exactly mirrors the structure of recursive calls of DFS-V ISIT . That is, u = v . π if and only if DFS-V ISIT ( G , v ) was called during a search of u ’s adjacency list. Additionally, vertex v is a descendant of vertex u in the depth-first forest if and only if v is discovered during the time in which u is gray.