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

# isLeaf -- determines if an edge (or vertex) is a leaf of a (hyper)graph

- Usage:
    `b = isLeaf(G,N)`
    `b = isLeaf(H,n)`
    `b = isLeaf(H,V)`
- Inputs:
  - G, a graph,
  - H, a hypergraph,
  - n, an integer, an index of an edge
  - V, a ring element, a vertex
- Outputs:
  - b, a Boolean value, true if edge n is a leaf or if vertex V has degree 1

## Description

An edge in a graph is a leaf if it contains a vertex of degree one. An edge E in a hypergraph is a leaf if there is another edge B with the property that for all edges F (other than E), the intersection of F with E is contained in the intersection of B with E.

A vertex of a graph is a leaf if it has degree one. A vertex of a hypergraph is a leaf if it is contained in precisely one edge which is itself is leaf.

    i1 : R = QQ[a..f];

    i2 : G = graph {a*b,b*c,c*a,b*d};

    i3 : isLeaf(G, d)

    o3 = true

    i4 : isLeaf(G, getEdgeIndex(G, {b,d}))

    o4 = true

    i5 : isLeaf(G, a)

    o5 = false

    i6 : isLeaf(G, getEdgeIndex(G, {a,b}))

    o6 = false

    i7 : H = hyperGraph {a*b*c,b*d,c*e,b*c*f};

    i8 : K = hyperGraph {a*b*c,b*d,c*e};

    i9 : isLeaf(H, a)

    o9 = true

    i10 : isLeaf(H, getEdgeIndex(H, {a,b,c}))

    o10 = true

    i11 : isLeaf(K, a)

    o11 = false

    i12 : isLeaf(K, getEdgeIndex(K, {a,b,c}))

    o12 = false

## See also

- isForest -- determines whether a (hyper)graph is a forest
- isGoodLeaf -- determines if an edge is a good leaf

## Ways to use isLeaf:

- `isLeaf(Graph,ZZ)`
- `isLeaf(HyperGraph,RingElement)`
- `isLeaf(HyperGraph,ZZ)`

## For the programmer

The object isLeaf is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/EdgeIdeals.m2:3470:0.