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

Online Help

All Products    Maple    MapleSim


GraphTheory

  

FindCycle

  

find a cycle in the graph

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

FindCycle(G)

FindCycle(G, v)

Parameters

G

-

graph

v

-

vertices of the graph

Description

• 

FindCycle(G) returns a cycle in the graph G, if one exists, and otherwise returns the empty list.

• 

FindCycle(G,v) returns a cycle in the graph G which includes the vertex v, if one such cycle exists, and otherwise returns the empty list.

• 

FindCycle ignores self-loops.

• 

All edges appearing in a cycle must be distinct.

Examples

withGraphTheory:

GCycleGraph3,directed

GGraph 1: a directed graph with 3 vertices and 3 arcs

(1)

DrawGraphG

FindCycleG

3,1,2,3

(2)

FindCycleG,1

1,2,3,1

(3)

In this example, the empty list is returned since the graph is a tree.

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

TGraph 2: a directed graph with 5 vertices and 4 arcs

(4)

DrawGraphT,style=tree

FindCycleT

(5)

Compatibility

• 

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

• 

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

See Also

IsAcyclic