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

getEdge -- gets the n-th edge in a (hyper)graph



This function returns the n^{th} edge of the (hyper)graph.

i1 : S = QQ[a..f];
i2 : g = cycle S

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

o2 : Graph
i3 : edges g

o3 = {{a, b}, {b, c}, {c, d}, {d, e}, {e, f}, {a, f}}

o3 : List
i4 : getEdge (g,3)  -- counting starts from 0, so the 4th element in the above list

o4 = {d, e}

o4 : List
i5 : h = hyperGraph {a*b*c*d,d*e,a*f*c,a*d*f}

o5 = HyperGraph{"edges" => {{a, b, c, d}, {d, e}, {a, c, f}, {a, d, f}}}
                "ring" => S
                "vertices" => {a, b, c, d, e, f}

o5 : HyperGraph
i6 : getEdge (h,0) -- first edge

o6 = {a, b, c, d}

o6 : List

See also

Ways to use getEdge :

For the programmer

The object getEdge is a method function.