|
|
||
|
|
| Graph Utilities Package Symbol | Tutorials »|More About » |
| GraphDistanceMatrix[g] gives a matrix in which the (i, j) |
| GraphDistanceMatrix[g, Parent] returns a three-dimensional matrix in which the (1, i, j) |
Needs["GraphUtilities`"] This defines a simple directed graph:
This calculates the distance between the vertices:
This shows also the predecessors in the shortest path:
The path from 1 to 3 is {1, 5, 4, 3}:
This confirms the shortest path:
| |||||||||||||||||||||||||||
| © 2008 Wolfram Research, Inc. |