Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Graphs & Networks > Paths and Cycles > ShortestPathFunction >
Mathematica > Visualization and Graphics > Graphs & Networks > Paths and Cycles > ShortestPathFunction >

ShortestPathFunction

ShortestPathFunction
represents a function that gives the shortest path from a source vertex s to target vertex t in a graph.
Obtain a function that gives shortest paths from vertex 4:
Use it to show the shortest paths to all vertices:
Obtain a function that gives shortest paths from vertex 4:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Use it to show the shortest paths to all vertices:
In[3]:=
Click for copyable input
Out[3]=
ShortestPathFunction works with undirected graphs:
Directed graphs:
Weighted graphs:
A ShortestPathFunction can give shortest paths from a fixed vertex:
To a fixed vertex:
Between any pair of vertices:
ShortestPathFunction returns when no path exists:
New in 8
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF