知识卡片
按DFS完成时间逆序拓扑排序
- 对 DAG 运行 DFS;
- 每完成一个顶点就插入链表头,得到完成时间递减的顶点序。
DFS 与每点常数次插入合计 Θ(V+E)。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第20章 基本图算法 · 查看原书依据
The procedure TOPOLOGICAL-SORT topologically sorts a dag. Figure 20.7(b) shows how the topologically sorted vertices appear in reverse order of their finish times. TOPOLOGICAL-SORT(G) 1 call DFS(G) to compute finish times v.f for each
参考来源
- 位置:《算法导论(第4版)》第20章《基本图算法》(OEBPS/chapter020.xhtml,文本字符[50000,55000))。
- 结论依据:原文伪代码先算完成时间,再把每个完成顶点插入表头,并给出线性时间分析。
- 原始内容:The procedure T OPOLOGICAL -S ORT topologically sorts a dag. Figure 20.7(b) shows how the topologically sorted vertices appear in reverse order of their finish times. T OPOLOGICAL -S ORT ( G ) 1 call DFS( G ) to compute finish times v.f for each