知识卡片
全点对可重复单源求解
对每个顶点运行一次单源算法即可求全点对结果。
非负权可用 Dijkstra;有负边时不能直接用它,逐源 Bellman-Ford 会更慢,因此可寻找专门算法。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第23章 所有结点对的最短路径 · 查看原书依据
You can solve an all-pairs shortest-paths problem by running a single-source shortest-paths algorithm |V| times, once with each vertex as the source. If all edge weights are nonnegative, you can use Dijkstra’s algorithm. If
参考来源
- 位置:《算法导论(第4版)》第23章《所有结点对的最短路径》(OEBPS/chapter023.xhtml,文本字符[0,5000))。
- 结论依据:原文列出逐源求解与不同权重限制、复杂度对比。
- 原始内容:You can solve an all-pairs shortest-paths problem by running a single-source shortest-paths algorithm | V | times, once with each vertex as the source. If all edge weights are nonnegative, you can use Dijkstra’s algorithm. If