next up previous
Next: Up: Previous:

Matrix Multiplication Approach

Consider a shortest path p from vertex i to vertex j containing at most m edges.

By Lemma 25.1 (subpaths of shortest paths are shortest paths), p' is a shortest path from i to k, and \(\delta(i,j) \;=\; \delta(i,k) \;+\; w_{kj}\).

Thus, the shortest path problem exhibits optimal substructure.


next up previous
Next: Up: Previous: