FIFTH HOMEWORK: TREES
1. (10pts) Let T be a tree with n vertices, n ≥ 2. For a positive integer i, let mi be the
number of vertices of T of degree i. Prove
m1 − m3 − 2m4 − · · · − (n − 3)mn−1 = 2.
Hint: First of all, the total degree is
X
imi = 2(n − 1).
1≤i≤n−1
On the other hand, the total number of vertices is
X
mi = n.
1≤i≤n−1
Hence
2
X
1≤i≤n−1
X
mi −
imi = 2.
1≤i≤n−1
On the other hand, the LHS can be rewritten as
2
X
1≤i≤n−1
mi −
X
imi = (2m1 −m1 )+(2m2 −2m2 )+(2m3 −3m3 )+· · ·+(2mn−1 −(n−1)mn−1 )
1≤i≤n−1
= m1 − m3 − 2m4 − · · · − (n − 3)mn−1 .
2. (10pts) Let (d1 , . . . , dn ) be a sequence of integers. Prove that there is a tree of order
n with this degree sequence (i.e. graph score) if and only if d1 , . . . , dn are positive integers
with
d1 + · · · + dn = 2(n − 1).
Hint: We provide by induction in n. If n = 2, then the graph is just an edge, and one can
easily check. Assume that it is true up to n = k, for some k ≥ 2. Consider any tree T
on k + 1 vertices. By a claim in the lecture, we know that T contains at least two leaves,
1
2
FIFTH HOMEWORK: TREES
assume that v is such a leaf, and {u, v} is the only edge in T connects v. Consider the
graph T 0 = T − v, which is again a tree on k vertices. Notice that the degree score of T 0 is
different from that of T at exactly two places: d1 (T 0 ) = d1 (T ) − 1 and di (T 0 ) = di (T ) − 1,
where i is the degree of u. Furthermore, by induction,
d1 (T 0 ) + · · · + dk−1 (T 0 ) = 2(k − 1).
Thus we also have
2 + d1 (T 0 ) + · · · + dk−1 (T 0 ) = 2k.
Finally, the LHS is exactly d1 (T ) + · · · + dk (T ).
3. (10 pts) Prove of disprove (by giving a counter example) the statement that in a tree
the center(s) always lie on the longest path of the tree.
Hint: The statement is true. We can show this by either induction (which is rather straightforward using the lemma in class), or by direct method (in which case one has to be more
careful).
4. (10pts) Prove in detail that isomorphic trees (not rooted) receive the same code by the
procedure given in class, and non-isomorphic trees get distinct codes.
Hint: this can also be proved by induction. First, note that isomorphism maps center(s) to
center(s). Next, show that the two corresponding parts divided by the centers also receive
the same code.
5. (10pts) Analogously to the minimum spanning tree problem, define the maximum
spanning tree problem. Formulate a greedy algorithm for this problem and show that it
always finds an optimal solution.
Hint: We can follow Kruskal’s algorithm: first sort the edges in non-increasing order, and
choose one by one to add to the new graph, making sure that there is no new cycle created.
To verify this algorithm always produces maximal spanning tree, we follow exactly the same
proof as for Kruskal’s algorithm.
6* Bonus (10pts) Let G be a connected graph with a weight function w on the edges.
Prove that for each minimum spanning tree T of G, there is an initial ordering of the edges
in Kruskal’s algorithm such that the algorithm outputs the tree T .
Hint: Let T be a minimal spanning tree with edges ei1 , . . . , ein−1 (sorted in non-decreasing
weight order). To start Kruskal’s algorithm, order the edges of G in non-decreasing order
of weight so that eij is always listed first among the edges of the same weight.
7* Bonus (10pts)* [1, 5.5.8] Consider an n-point set V in the plane. We define a weight
function on the edge set of the complete graph on V : the weight of an edge {x, y} is the
FIFTH HOMEWORK: TREES
3
distance of the points x and y in the plane. Show that no minimum spanning tree for this
network has a vertex of degree 7 or higher.
Hint: Assume that in T there is a vertex v0 that is adjacent to other 7 vertices v1 , . . . , v7 ;
then there is a triangle vi v0 vj where the angle vi v0 vj is strictly smaller than π/3. As such,
the length vi vj is smaller than either v0 vi or v0 vj . Assume the the first case, then the new
tree where vi vj and v0 vi being swapped, T 0 := T ∪ {vi vj }\{v0 vi } is again a spanning tree,
and w(T 0 ) = w(T ) − w(v0 vi ) + wvi vj < w(T ), a contradiction.
References
[1] J. Matousek and J. Nesetril, Invitation to Discrete Mathematics, second edition.
© Copyright 2026 Paperzz