Similarly, A3 represents the lengths of all shortest paths of three or fewer
edges, and so on. Since, in a connected, weighted graph with n vertices, there
can be at most n − 1 edges in the shortest path between two vertices, the
following theorem has been proved.