Macaulay2 » Documentation
Packages » EdgeIdeals :: cycle
next | previous | forward | backward | up | index | toc

cycle -- returns a graph cycle



Give a list of vertices (perhaps in some specified order), this function returns the graph of the cycle on those vertices, using the order given or the internal ordering of the vertices. Unspecified vertices are treated as isolated vertices.

i1 : R = QQ[a,b,c,d,e];
i2 : cycle R

o2 = Graph{"edges" => {{a, b}, {b, c}, {c, d}, {d, e}, {a, e}}}
           "ring" => R
           "vertices" => {a, b, c, d, e}

o2 : Graph
i3 : cycle(R,3)

o3 = Graph{"edges" => {{a, b}, {b, c}, {a, c}}}
           "ring" => R
           "vertices" => {a, b, c, d, e}

o3 : Graph
i4 : cycle {e,c,d,b}

o4 = Graph{"edges" => {{c, e}, {c, d}, {b, d}, {b, e}}}
           "ring" => R
           "vertices" => {a, b, c, d, e}

o4 : Graph
i5 : R = QQ[a,c,d,b,e];-- variables given different order
i6 : cycle R

o6 = Graph{"edges" => {{a, c}, {c, d}, {d, b}, {b, e}, {a, e}}}
           "ring" => R
           "vertices" => {a, c, d, b, e}

o6 : Graph

See also

Ways to use cycle :

For the programmer

The object cycle is a method function.