This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


ShortestPath[g, start, end]
finds a shortest path between vertices start and end in graph g.
  • The default is Algorithm->Automatic. In this case, depending on whether edges have negative weights and depending on the density of the graph, the algorithm chooses between BellmanFord and Dijkstra.