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 ^(th) entry is the length of a shortest path in g between vertices and .


returns a three-dimensional matrix with dimensions , in which the ^(th) entry is the length of a shortest path from to and the ^(th) entry is the predecessor of in a shortest path from to .

更多信息更多信息