next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Matroids :: getCycles

getCycles -- find cycles of graph

Synopsis

Description

A cycle of G is a connected, 2-regular subgraph of G (i.e. every vertex has degree 2). This method returns all cycles of length at least 3, as ordered lists of vertices (for cycles of length 1 or 2, see the options Loops and ParallelEdges at matroid). This method is used to create the graphic matroid: the output is in bijection with the circuits of the graphic matroid (excluding loops and parallel edges).

i1 : getCycles completeGraph 4

o1 = {{0, 1, 2, 0}, {0, 1, 3, 0}, {0, 2, 3, 0}, {0, 1, 2, 3, 0}, {0, 1, 3, 2,
     ------------------------------------------------------------------------
     0}, {0, 2, 1, 3, 0}, {1, 2, 3, 1}}

o1 : List

Ways to use getCycles :

For the programmer

The object getCycles is a method function.