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

## Synopsis

• Usage:
b = isLeaf(G,N)
b = isLeaf(H,n)
b = isLeaf(H,V)
• Inputs:
• G, ,
• H, ,
• n, an integer, an index of an edge
• V, , a vertex
• Outputs:
• b, , 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