ShortestPathFunction

ShortestPathFunction[type, data]
represents a function that gives the shortest path from a source vertex s to target vertex t in a graph.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

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]=
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »