Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


gives the distance from source vertex s to target vertex t in the graph g.

gives the distance from s to all vertices of the graph g.

uses rules to specify 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.
  • The following options can be given:
  • EdgeWeightAutomaticweight for each edge
    MethodAutomaticmethod to use
  • Possible Method settings include , , and .
Introduced in 2010
| Updated in 2015