In graph theory, a cycle graph is one in which all the nodes are connected in a single circle.

USING: kernel math math.parser sequences
graphviz graphviz.notation graphviz.render ;
: add-cycle ( graph n -- graph' )
[ <iota> add-path ] [ 1 - 0 add-edge ] bi ;
: C_n ( n -- )
<graph>
[graph "t" =labelloc "circo" =layout ];
[node "point" =shape ];
over number>string "C " prepend =label
swap add-cycle
preview ;

5 C_n

6 C_n

7 C_n