Correctness of Floyd–Warshall #
One round of Floyd–Warshall with pivot k replaces D i j by min (D i j) (D i k + D k j),
which over MinTropical R is fwStep D k i j = D i j + D i k * D k j. Starting from
withOneDiag W and running a round for every vertex yields the shortest-distance matrix, for any
order of the pivots and whenever W has no negative cycles.
The proof keeps the invariant of CLRS Section 25.2: after the pivots in S have been processed,
every entry is 0 or the weight of a walk, and lies below every walk without repeated vertices
whose intermediate vertices all lie in S.
Main definitions #
Cslib.Algorithms.ShortestPaths.fwStep: one Floyd–Warshall round.
Main results #
Cslib.Algorithms.ShortestPaths.isShortestDistances_foldl_fwStep: correctness of Floyd–Warshall for every pivot list containing all vertices.
References #
One round of Floyd–Warshall with pivot k: D' i j = min (D i j) (D i k + D k j).
Correctness of Floyd–Warshall. If W has no negative cycles and the pivot list ks
contains every vertex, then running Floyd–Warshall from withOneDiag W with the pivots ks
yields the shortest-distance matrix.