ShortestPathFunction

ShortestPathFunction[type,data]

represents a function that gives the shortest path from a source vertex s to target vertex t in a graph.

Details

Examples

open allclose all

Basic Examples  (1)

Obtain a function that gives shortest paths from vertex 4:

Use it to show the shortest paths to all vertices:

Scope  (7)

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:

Introduced in 2010
 (8.0)