A tree leaf of an unrooted tree is a node of vertex degree 1. Note that for a rooted or planted tree, the root vertex is generally not considered a leaf node, whereas all other nodes of vertex degree 1 are.
A function to return the leaves of a tree may be implemented in a future version of the Wolfram Language as LeafVertex[g].
The following table gives the total numbers of leaves for various classes of simple graphs and trees on ,
2, ... nodes. Unlabeled objects are counted up to
graph isomorphism, with the root
vertex preserved where present, and each leaf graph
vertex is counted separately. Note that for rooted
and planted trees, the root
vertex is generally not counted as a leaf, even if it has vertex
degree 1. For rooted trees with
nodes, these counts
agree with OEIS A003227, whose first term counts
the singleton graph as having one leaf. OEIS A003228 likewise counts one leaf at the singleton
graph, while the convention here gives 0 in both cases. For planted
trees with
nodes, OEIS A003227
is evaluated at
, because the additional root vertex adds one vertex
to a rooted tree. At
,
the root vertex of the old singleton
graph becomes a nonroot leaf, so the first term of that sequence correctly gives
1. There is no planted tree with one graph
vertex.
| graph type | OEIS | leaf count for |
| graph | A055540 | 0, 2, 4, 14, 38, 153, 766, 6259, 88064, ... |
| labeled graph | A095338 | 0, 2, 12, 96, 1280, 30720, ... |
| labeled tree | A055541 | 0, 2, 6, 36, 320, 3750, ... |
| planted tree | A003227 | 0, 1, 1, 3, 8, 22, 58, 160, 434, 1204, 3341, 9363, ... |
| planted tree including root nodes | A095339 | 0, 2, 2, 5, 12, 31, 78, 208, 549, 1490, 4060, 11205, ... |
| rooted tree | A003227 | 0, 1, 3, 8, 22, 58, 160, 434, 1204, 3341, 9363, 26308, ... |
| rooted tree including degree-1 root nodes | A095337 | 0, 2, 4, 10, 26, 67, 180, 482, 1319, 3627, 10082, 28150, ... |
| tree | A003228 | 0, 2, 2, 5, 9, 21, 43, 101, ... |