AllPairsShortestPath[g] gives a matrix, where the entry is the length of a shortest path in between vertices and .
returns a three-dimensional matrix with dimensions , in which the entry is the length of a shortest path from to and the entry is the predecessor of in a shortest path from to .