GraphTheory
CycleGraph
construct cycle graph
PathGraph
construct path graph
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
CycleGraph(n,opts)
CycleGraph(V,opts)
PathGraph(n,opts)
PathGraph(V,opts)
n
-
positive integer
V
list of vertices
opts
(optional) one or more options as specified below
The opts argument can contain one or more of the options shown below.
directed=true or false
This option specifies whether the resulting graph should be directed. The default is false.
edgelabels=e
Specifies labels for the edges for use with DrawGraph. The value is a set of equations in which the left-hand side of each equation is an edge and the right-hand side is a string specifying the desired label.
Each edge must be expressed as a list of vertices if the graph is directed and as a set of vertices if it is undirected.
The default is the empty set.
layout=true or false
This option specifies whether a default coordinate assignment for the vertices of the graph should be made. The default is true.
CycleGraph(n) outputs a graph which is a cycle on n vertices labeled 1, 2, ..., n.
PathGraph(n) outputs a graph which is a path on n vertices labeled 1, 2, ..., n.
In both cases you can input the labels for the vertices as a list of integers, strings, or symbols.
withGraphTheory:
C≔CycleGraph4
C≔Graph 1: an undirected graph with 4 vertices and 4 edges
EdgesC
1,2,1,4,2,3,3,4
DrawGraphC
P≔PathGrapha,b,c,d
P≔Graph 2: an undirected graph with 4 vertices and 3 edges
EdgesP
a,b,b,c,c,d
DrawGraphP
The directed and layout options were introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
The GraphTheory[CycleGraph] and GraphTheory[PathGraph] commands were updated in Maple 2025.
The edgelabels option was introduced in Maple 2025.
For more information on Maple 2025 changes, see Updates in Maple 2025.
See Also
DrawGraph
Edges
Graph
Download Help Document