AllPairsShortestPath

As of Version 10, most of the functionality of the Combinatorica package is built into the Wolfram System. >>

AllPairsShortestPath[g]gives a matrix, where the entry is the length of a shortest path in g between vertices and .

AllPairsShortestPath[g,Parent]returns a three-dimensional matrix with dimensions 2*V[g]*V[g], 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 .