The tripartite graph of a (min,+) product #
The (min,+) product A * B of two ι × ι matrices is a shortest-distance block of a graph with
three copies of ι: tripartite A B on Fin 3 × ι has an edge (0, i) → (1, j) of weight
A i j, an edge (1, j) → (2, k) of weight B j k and no other edges. Every walk with a finite
weight climbs one layer per edge, so the graph has no cycles at all, hence no negative cycles,
and the walks from (0, i) to (2, k) of finite weight are exactly the two-edge walks through
some (1, j). Thus the shortest distance from (0, i) to (2, k) is (A * B) i k.
This is the reduction from (min,+) products to all-pairs shortest paths on 3 n vertices.
Main definitions #
Cslib.Algorithms.ShortestPaths.tripartite: the tripartite graph ofAandB.
Main results #
Cslib.Algorithms.ShortestPaths.noNegCycle_tripartite: the tripartite graph has no negative cycles.Cslib.Algorithms.ShortestPaths.isGLB_tripartite: the shortest distance from(0, i)to(2, k)is(A * B) i k.Cslib.Algorithms.ShortestPaths.IsShortestDistances.tripartite_block: the same for any shortest-distance matrix of any relabelling of the tripartite graph.
References #
The tripartite graph has no negative cycles: its only closed walks of finite weight are the empty ones.
In the tripartite graph, the shortest distance from (0, i) to (2, k) is the
(min,+) product entry (A * B) i k.
If D is the shortest-distance matrix of any relabelling e of the tripartite graph of
A and B, then its block from layer 0 to layer 2 is the (min,+) product A * B.