Take a shortest allowed simple graph path. If it does not use as an intermediate vertex, its length is at least . If it does, simplicity makes occur only once. Splitting there gives an -- path and a -- path whose intermediate vertices are in . Their lengths are at least the respective two minima. In either case,
For identical endpoints use the usual empty path of length zero.
An old shortest graph path is still allowed at stage , so . Concatenating shortest -- and -- paths gives a walk of length , but it may repeat vertices. Every repeated section is a closed walk. In the absence of negative-length cycles in a graph, each such closed walk has nonnegative length: decompose it into simple cycles. Removing these sections therefore produces an allowed simple graph path of no greater length. This proves the other upper bound. Together with part (a),
Initialize an array with and for . For , replace every entry in place by
This is the Floyd-Warshall algorithm. At the start of stage , the induction hypothesis is . During that stage, row and column do not change: and no negative cycle can lower it. Hence the operands remain the stage-start values even with in-place updates. Part (b) proves that after the stage every entry is . Induction gives all shortest path lengths after stage . The algorithm uses stored lengths and arithmetic operations, with only a fixed number of loop counters beyond the array.
Use four vertices, with lengths , , and every other non-loop arc of length . The two arcs between and form a negative-length cycle in a graph. For , , ,
The recurrence would give , by concatenating and . That walk repeats , so it is not a simple graph path. Every simple graph path from to still has length at least zero, attained by . Thus
a strict inequality in part (a).

Articles by others on the same topic (0)

There are currently no matching articles.