finds the shortest path from source vertex s to target vertex t in the graph g.
uses rules to specify the graph g.
- FindShortestPath[g,s,t] gives a path from s to t.
- FindShortestPath[g,s] is equivalent to FindShortestPath[g,s,All].
- FindShortestPath[g] is equivalent to FindShortestPath[g,All,All].
- For an unweighted graph, edge length is assumed to be 1.
- For a weighted graph, edge length is taken to be the weight.
- A Method option can also be given. Possible Method settings include:
"BellmanFord" supports positive and negative weights "Dijkstra" supports positive weights
- FindShortestPath works with undirected graphs, directed graphs, weighted graphs, multigraphs, and mixed graphs.
Introduced in 2010
(8.0)| Updated in 2015