|
SOLUTIONS
|
BUILT-IN MATHEMATICA SYMBOL
GraphDistance
GraphDistance[g, s, t]
gives the distance from source vertex s to target vertex t in the graph g.
GraphDistance[g, s]
gives the distance from s to all vertices of the graph g.
Details and OptionsDetails and Options
- GraphDistance[g, s, t] will give the length of the shortest path between s and t.
- The distance is Infinity when there is no path between s and t.
- For a weighted graph, the distance is the minimum of the sum of weights along any path between s and t.
New in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »

