Graph Utilities Package >

GraphDistanceMatrix

GraphDistanceMatrix[g]
gives a matrix in which the (i, j)^(th) entry is the length of a shortest path in g between vertices i and j.
GraphDistanceMatrix[g, Parent]
returns a three-dimensional matrix 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.
  • The following options can be given:
MethodAutomaticthe method used to compute the shortest path
WeightedTruewhether edge weights are to be taken into account
© 2008 Wolfram Research, Inc. japanese.gif
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team