SOME NOTES ON UNICYCLIC GRAPHS
JOEL BREWSTER LEWIS
4707 SPRING 2015
ADAPTED FROM ASYMPTOPIA BY SPENCER AND FLORESCU
1. Introduction
Section 8.4 of Lovász, Pelikán and Vesztergombi’s text (and many other resources) establishes that the Prüfer code gives a bijection between labeled trees on n vertices and words
of length n − 2 on the alphabet {0, 1, . . . , n − 1}. We used this as the key ingredient in our
proof (one of many possible) of Cayley’s Theorem. But in fact we can learn much more from
it.
2. Counting trees by the degree of the root
Given a labeled tree T with vertex set {0, 1, . . . , n − 1}, it follows immediately from the
definition of the Prüfer code that the number of times 0 appears in the code is equal to one
less that the degree of the node 0 in T . (One less, because of the missing (n − 1)st column
recording the parent of the last deleted vertex.) Thus, the Prüfer code is a bijection between
trees with vertex set {0, 1, . . . , n − 1} in which vertex 0 has degree r and words of length
n − 2 on the alphabet {0, 1, . . . , n − 1} in which 0 appears exactly r − 1 times.
Proposition 1. The number of labeled trees on n vertices in which the node labeled 0 has
degree r is
n−2
· (n − 1)n−r−1 .
r−1
Proof. We have already remarked that the number of such trees is equal to the number of
words of length n − 2 on the alphabet {0, 1, . . . , n − 1} in which 0 appears exactly r − 1
times.
To produce such a word, we must first choose r − 1 of the n − 2 positions to be 0, in
n−2
ways. Given such a choice, there are (n − 2) − (r − 1) = n − r − 1 remaining positions,
r−1
and these must be filled with the values {1, . . . , n − 1}. This can be done in (n − 1)n−r−1
ways, independent of the positions of the 0s.
3. Rooted forests
A forest is a graph with no cycles. (It is so-called because each connected component is a
tree, so a forest is a collection of trees.) A rooted forest is a forest in which every component
has a specified vertex, called the root. (For example, if a component has a single vertex then
this vertex is the root.) The following proposition gives a simple formula for the number of
rooted forests with a given number of vertices and components.
Proposition 2. The number of rooted forests on n labeled vertices with r components is
n−1
· nn−r .
r−1
1
J
2OEL BREWSTER LEWIS 4707 SPRING 2015 ADAPTED FROM ASYMPTOPIA BY SPENCER AND FLORESCU
Proof. We give a bijection between labeled trees on n + 1 vertices in which node 0 has degree
r and labeled rooted forests on n vertices with r components. Given such a tree T , delete
the node 0 and all edges incident to it to create a graph F on n vertices. The graph F is
a forest, and each component of F contains exactly one vertex that was a neighbor of 0 in
T (why?). Make these nodes the roots. To reverse the bijection, create a new node 0 and
connect it to the root in every component.
Remark 3. It is also possible to give a variant of the Prüfer code that works directly with
rooted forests.
4. Exact enumeration of unicyclic graphs
A graph is called unicyclic if it is connected and has the same number of vertices and
edges.
Exercise 1. Prove that every unicyclic graph has exactly one cycle. [Hint: Possibly a
unicyclic graph has some vertices of degree 1. Delete them. The resulting graph is still
unicyclic (why?). Repeat this process until all vertices have degree at least 2. What can you
say about the resulting “core” graph?]
Theorem 4. The number of unicyclic graphs on n labeled vertices is
n
nn−1 X n · (n − 1) · (n − 2) · · · (n − r + 1)
·
.
2
nr
r=3
Proof. Let G be a unicyclic graph on n vertices, and suppose that its (unique) cycle has
length r (where of course 3 ≤ r ≤ n). We may produce a rooted forest F on n vertices with
r components in the following way: delete all the edges in the cycle, and make each vertex
that belonged to the cycle the root in its component. However, unlike in the previous result,
it is not possible to uniquely reconstruct G from F : for each rooted forest, there are many
ways to draw in a cycle connecting the roots of its components. In particular, the number
r!
of ways to do this is precisely 2r
(why?). Thus, the number of unicyclic graphs on n vertices
r!
with cycle of length r is exactly 2r
times the number of rooted forests on n vertices with r
n−1
r!
n−r
components, or 2r · r−1 · n . Perform a bit of cancellation and rearrangement and sum
over r to get the result.
5. Asymptotic enumeration of unicyclic graphs
The preceding result tells us exactly how many unicyclic graphs there are on n vertices,
but it is difficult to see roughly how large this number is from the given formula, say for
n = 100. The factor nn−1 in front of the formula suggests that there are at least (on the
order of) n times as many unicyclic graphs as trees, but how large is the sum? Each term in
the sum is certainly at most 1, and they get smaller as r gets larger. But can we say more?
In fact, the summand should resemble the calculation that we made when studying the
birthday problem (LPG §2.5). And, indeed, the sorts of computations we made there (and
√
is §§2.3, 3.7, 3.8) can give a precise estimate to the sum. We already saw that for r near n
is on the order of 21 (that is to say, still fairly
we have that A(n, r) := n·(n−1)·(n−2)···(n−r+1)
nr
large). In fact, one can show (though we do not here) more precisely the following things:
√
• if r = o( n) then A(n, r) is close to 1;
SOME NOTES ON UNICYCLIC GRAPHS
3
√
2
• if r ∼ c n for constant c then A(n, r) ∼ e−c /2 (so, is near 1 if c is small but decreases
very quickly
(faster than exponential) with c);
√
• if r n then A(n, r) decreases sufficiently quickly as to be negligible.
√
These suggest taking the scaling r = c n, in which case we have
n
n
X
X
2
A(n, r) ∼
e−c /2
r=3
Zr=3n
∼
e−c
2 /2
dr
3
∞
√
2
e−c /2 n dc
0
Z ∞
√
2
e−c /2 dc.
= n·
Z
∼
0
The final integral obviously converges; if you had a good multivariable
calculus class (or
p
probability, or . . . ) then you learned that in fact it converges to π/2 (the usual proof
involves multiplying two copies of the integral in different variables, then switching to polar
coordinates). But in any case we can certainly conclude from this argument that the number
of unicyclic graphs is
√
Θ(nn−1 · n) = Θ(nn−1/2 ).
In particular, we have that the number of unicyclic graphs on n vertices is, up to a constant
factor, n3/2 times the number of trees on n vertices.
© Copyright 2026 Paperzz