https://en.wikipedia.org/wiki/Optimal_substructure
Optimal substructure - Wikipedia
Figure 1. Finding the shortest path using optimal substructure. Numbers represent the length of the path; straight lines indicate single edges, wavy lines indicate shortest paths, i.e., there might be other vertices that are not shown here. In computer sci
en.wikipedia.org