知识卡片
Floyd前驱矩阵随距离更新
可在 Floyd 距离矩阵迭代时同步维护前驱矩阵:
- 若经 k 的新路径更短,i→j 的最终前驱取 k→j 子路径上的前驱;
- 否则沿用旧前驱。
这样能还原实际路径。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第23章 所有结点对的最短路径 · 查看原书依据
can be computed while the algorithm computes the matrices D(0), D(1),
参考来源
- 位置:《算法导论(第4版)》第23章《所有结点对的最短路径》(OEBPS/chapter023.xhtml,文本字符[20000,25000))。
- 结论依据:原文描述前驱随中间点选择更新;Art_P714–P715给出初值与递推。
- 原始内容:Alternatively, the predecessor matrix … can be computed while the algorithm computes the matrices D (0) , D (1) , … , D ( n ) . Specifically, compute a sequence of matrices Π (0) , Π (1) , … , Π ( n ) , where Π = Π ( n ) and is