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

Online Help

All Products    Maple    MapleSim


GraphTheory

  

AllSimplePaths

  

find all simple paths between two vertices

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

AllSimplePaths(G, u, v)

Parameters

G

-

graph

u, v

-

vertices of the graph

Options

• 

maxweight = extended_numeric

  

Specifies a maximum weight for the paths returned. Paths exceeding this will be omitted from the iteration. The default is infinity.

• 

output = one of iterator, list, or set

  

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

Description

• 

AllSimplePaths(G, u, v) returns all simple paths from u to v in a graph G.

• 

The default output is an Iterator.

• 

A simple path is one in which each vertex in the path is distinct.

Examples

withGraphTheory:

C6CycleGraph6

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

(1)

IsReachableC6,1,5

true

(2)

iterAllSimplePathsC6,1,5

iterPath Iterator

(3)

forpathiniterdoprintpathenddo

1,6,5

1,2,3,4,5

(4)

AllSimplePathsC6,1,5,output=set

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

(5)

W6Graph1,2,10,1,6,6,2,3,10,3,4,10,4,5,10,5,6,5

W6Graph 2: a directed weighted graph with 6 vertices and 6 arcs

(6)

DrawGraphW6,layout=circle

AllSimplePathsW6,1,6,output=list

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

(7)

AllSimplePathsW6,6,1,output=list

(8)

Compatibility

• 

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

• 

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

See Also

BellmanFordAlgorithm

DijkstrasAlgorithm

Distance

IsReachable

IsSimplePath

Reachable