Combinatorica Package >

AllPairsShortestPath

AllPairsShortestPath[g]
gives a matrix, where the (i,j)^(th) entry is the length of a shortest path in g between vertices i and j.
AllPairsShortestPath[g, Parent]
returns a three-dimensional matrix with dimensions 2*V[g]*V[g], in which the (1,i,j)^(th) entry is the length of a shortest path from i to j and the (2,i,j)^(th) entry is the predecessor of j in a shortest path from i to j.
© 2008 Wolfram Research, Inc. japanese.gif
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team