GraphTheory/AllShortestPaths - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : GraphTheory/AllShortestPaths

GraphTheory

  

AllShortestPaths

  

find all shortest paths between two vertices

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

AllShortestPaths(G, u, v)

Parameters

G

-

graph

u, v

-

vertices of the graph

Options

• 

output = one of iterator, list, or set

  

Specifies what is returned from AllShortestPaths. The default is iterator.

Description

• 

AllShortestPaths(G, u, v) returns all shortest paths from u to v in a graph G.

• 

The default output is an Iterator.

Examples

withGraphTheory:

C6CycleGraph6

C6Graph 1: an undirected graph with 6 vertices and 6 edges

(1)

iterAllShortestPathsC6,1,4

iterShortest Path Iterator

(2)

forpathiniterdoprintpathenddo

1,2,3,4

1,6,5,4

(3)

C23CompleteGraph2,3

C23Graph 2: an undirected graph with 5 vertices and 6 edges

(4)

AllShortestPathsC23,1,2,output=set

1,3,2,1,4,2,1,5,2

(5)

Compatibility

• 

The GraphTheory[AllShortestPaths] command was introduced in Maple 2025.

• 

For more information on Maple 2025 changes, see Updates in Maple 2025.

See Also

BellmanFordAlgorithm

DijkstrasAlgorithm

Distance

IsReachable

Reachable