If shortest path p from s to v can be decomposed into , then p' is a shortest path from s to u, and .

Because the problem has optimal substructure, we can try to use dynamic programming and greedy algorithms.