You are on page 1of 6

Math 145 Homework 7 Solutions

Problem 1. In class we drew all 3 types of unlabelled trees on 5 vertices, and then counting
how many labelling there were for each tree, which added up to 125 total labelled trees for
n = 5.
Now repeat the same procedure for n = 6. Draw all distinct types of unlabelled trees on
6 vertices (there should be 6 types), and then for each type count how many distinct ways it
could be labelled. Verify that your 6 cases sum to the total of 64 = 1296 labelled trees.

Solution. There are 6 types of trees, with label counts given below:

The three counts of 360 each come from noticing there are exactly two symmetries of each
of those three, so the full 6! labellings overcounts by a factor of 2.
The star has 6, as generalized later. The third tree has 3! symmetries (permuting the
leaves at the left). The fifth tree can be counted as 6!/8 by noticing there are 2 · 2 · 2 symmetries
(independently permute  each
 end pair and also reflect the whole thing left/right). Alternatively,
we can count it as 62 42 by first choosing which two elements are in the middle, and then
choosing which two elements go on the side next to the middle element with the smaller label
(you have to be careful with an argument like this not to over/undercount).

Problem 2. For the following tree on 9 labelled vertices, find its Prufer code:

1
(The Prufer code should be a string of 7 numbers between 0 and 8).
Then for the following Prufer code: 602440, draw the labelled tree it describes (this code
should uniquely describe a labelled tree on 6 + 2 = 8 labelled vertices 0, 1, . . . , 7).

Solution. The tree pictured gives a two line Prufer code of

12436785
07387050

so the Prufer code string is 0738705.


The Prufer code string 602440 expands to the two line code of

1352647
6024400

and then the tree can be reconstructed (for example by reading right to left) as

2
Problem 3. Recall the star Sn is a tree on n+1 vertices that consists of a single vertex connected
to every other vertex (ie. it is the complete bipartite graph K1,n ). How many different distinct
labellings are there for the star graph? For each distinct labeled Sn (using labels 0, 1, . . . , n),
find its Prufer code. (Each Prufer code here should be a string of n + 1 − 1 = n − 1 numbers
each between 0 and n).

Solution. There are n + 1 distinct labellings (n + 1 choices for the label of the unique central
node). If i ∈ {0, . . . , n} is the label of the central node, then the two line Prufer code is
1 2 3 . . . (i − 1) (i + 1) . . . n i
i i i ... i i ... i 0
so the Prufer code string is ii . . . i. Thus the n + 1 constant character strings correspond to
the stars.

Problem 4. (*) Define a double star to be a tree that has exactly two vertices which are not
leaves (so a double star only exists for n ≥ 4 vertices). Find a formula for the number of
unlabeled double star graphs on n vertices (where n ≥ 4). Also find a formula for the number
of labeled double star vertices.

Solution. Let i, j be the number of leaves on each side of the double star. Then we must have
i + j = n − 2 and i ≥ 1, j ≥ 1. For unlabelled trees, these counts i and j are indistinguishable,
so the number of distinct sets {i, j} ends up being b n−2
2 c.
To count the number of labelled double stars, there are n2 ways to choose which pair of


labels will be in the middle. Then for each other label, we can independently choose if it is
connected to the larger or smaller middle label, giving 2n−2 choices, but 2 of them are disallowed
(giving all leaves to one side). Thus we end up with
 
n
(2n−2 − 2) = n(n − 1)(2n−3 − 1)
2

labelled double stars.

Problem 5. Prove that a graph with n vertices and m edges has at least n − m connected
components.

3
Solution. One way to prove this is by induction on m (for a fixed n). The base case m = 0
edges corresponds to the edgeless graph on n vertices, where the n connected components are
simply the vertices. For the induction step, if we have n vertices and m + 1 edges, consider
removing an arbitrary edge. Then we have m edges, and at least n − m connected components.
If this edge disconnects the two vertices on either side, the number of connected components
will increase by 1 (otherwise the number will not change).

Problem 6. A forest is an acyclic graph (so each connected component is a tree). Prove that
a forest is two-colorable. If a forest has n vertices and m edges, how many different 2-colorings
are there?

Solution. A forest with n vertices and m edges will consist of exactly n − m connected compo-
nents, which are trees. This can be proven similar to Problem 5 by induction on m since adding
each edge must connect two disconnected components (adding an edge within a tree will create
a cycle).
Now a tree is two-colorable (by the general result that every graph with no odd cycles is
two-colorable, and there are precisely 2 two-colorings, since after fixing the color of one vertex,
the unique path to every other vertex will force all colors to be determined. Then for a forest
with n − m trees there are 2 independent ways to color each of the n − m trees, giving 2n−m
total colorings.

Problem 7. Find the chromatic number of the following graph

(ie. find the amount of colors c such that you can color this graph with c colors, and prove
you cannot with c − 1 colors).

Solution. The chromatic number is 4. A 4-coloring is simple to find, for example 3 color the
outer most ring, then make the inner ring have colors matching the corresponding ‘twin’ outer
vertex, then use a unique 4th color for the center vertex.
Proving there is no 3 coloring could be done in a straightforward but messy way by starting
from the outer ring (with C7 as a subgraph) needing 3 unique colors, then showing that WLOG
this forces there to be 3 unique colors on the inner ring, and then the central point must use a
4th color.
A cleaner argument comes from first considering one color used for the central point. If
there were a 3-coloring, then the 7 points in the inner ring could be colored using 2 remaining
colors. Now notice that for any coloring of the 7 points on the inner ring, we can color the 7
points of the outer ring to match their ‘twin’ on the inner ring (the vertex on the inner ring
that is also connected to the same pair of vertices on the outer ring). If each vertex on the outer
ring was colored to match the inner ring twin, there will be no collisions, since each vertex on

4
the outer ring is connected to its two neighbors on the outer ring, and their two ‘twin’ vertices.
Thus if there were a 2-coloring of the inner ring, this implies there can be a 2-coloring of the
outer ring, which gives a 2-coloring of C7 , a contradiction.

Problem 8. Let G be a connected graph such that all vertices but d + 1 have degree at most d
(the remaining d + 1 vertices may have degree larger than d). Prove that G is d + 1 colorable.

Solution. We argue by induction, where the base case will consist of all connected graphs on
1, 2, . . . , d + 1 vertices. These are all clearly d + 1 colorable by choosing a unique color for every
vertex.
Now we consider a graph G on n > d + 1 vertices such that all but d + 1 vertices have degree
at most d. Remove one of the vertices with degree at most d, which gives a graph G0 on n − 1
vertices with the same property, so by the inductive hypothesis G0 has a d + 1 coloring. Now
add the removed vertex back in. Since it has at most d neighbors, there must be at least one of
d + 1 colors not used by its neighbors, so giving it that color gives a d + 1 coloring of G.

Problem 9. For the following graph, first find it’s chromatic number c. Then count how many
ways it can be colored using k colors, for any k ≥ c.

Solution. The chromatic number is 3. There is no 2-coloring because of the odd cycle / K3 that
is a subgraph. It is straightforward to find a 3-coloring assigning colors from left to right.
If we then have k colors, we can color from left to right with k choices for the leftmost vertex,
then k − 1 choices for its neighbor. There are then two neighbors which fill a triangle, with
(k − 1)(k − 2) choices for them. After these vertical neighbors have distinct colors, there are
k − 2 choices for the third vertex from the right, and then k − 1 choices for the last two vertices.
Since each of these choices can be made independently in succession, by the multiplication rule
we have
k(k − 1)2 (k − 2)2 (k − 1)2 = k(k − 1)4 (k − 2)2
total colorings.

Problem 10. (**) In class we saw that using k colors, there were k(k − 1)(k − 2) ways to color
a 3-cycle (triangle), and there were k(k − 1)2 + k(k − 1)(k − 2)2 ways to color a 4-cycle.
There is a general formula, that using k colors you can color the n-cycle Cn in (k − 1)n +
(−1)n (k − 1) different ways. Prove this result holds for all n.

Solution. David also mentioned some general techniques in class Wednesday that can be give
an approach to this problem, but here is an argument from first principles.
Labelling the vertices 1, . . . , n, we could consider choosing colors the vertices in order. The
naive approach would give k(k − 1)n−1 choices for our colors, but these colorings would be in
two distinct groups, colorings where 1 and n have different colors (which is what we want) and
colorings where 1 and n have the same color. But now notice that any coloring with 1 and n
having the same color (and all other neighbors distinct) is exactly a coloring of Cn−1 (since we
can collapse 1 and n and view then as the same vertex. Thus if P (Cn , k) is the number of ways
to color Cn with k colors, we have

k(k − 1)n−1 = P (Cn , k) + P (Cn−1 , k)

5
which gives a recurrence for P (Cn , k) in terms of P (Cn−1 , k).
Now we can verify that the formula P (Cn , k) = (k − 1)n + (−1)n (k − 1). First we can verify
the base case, since P (C3 , k) = k(k − 1)(k − 2) = (k − 1)3 − (k − 1) (or we could use as a base
case C2 with P (C2 , k) = k(k − 1) = (k − 1)2 + (k − 1)). Now we verify the recurrence by showing

P (Cn , k) + P (Cn−1 , k) = (k − 1)n + (−1)n (k − 1) + (k − 1)n−1 (−1)n−1 (k − 1)


= (k − 1)n + (k − 1)n−1
= (k − 1 + 1)(k − 1)n−1 = k(k − 1)n−1

You might also like