4

My combinatorics class is covering spanning trees right now and one of the questions being asked is "What is the number of labeled trees on n vertices with exactly $3$ vertices of degree $1$?"

I've tried a couple different ways of doing this and none of them seem to work. I tried examining the degree sequence, looking at the Prüfer code as words from an $[n-3]$ length alphabet, but it seems fruitless.

Any help would be greatly appreciated. Thanks!

Edit: I mis-read the problem, this was first posted with at least 3 vertices of degree 1, but the actual problem states exactly 3 vertices of degree 1.

azimut
  • 24,316
walkar
  • 4,312
  • Do you know the total number of labeled trees? Then compute how many have only two vertices of degree 1. – Ross Millikan Oct 01 '13 at 18:39
  • 2
    Yes, it's $n^{n-2}$ but how do I pare that down into the ones with 3 vertices of degree 1? – walkar Oct 01 '13 at 18:45
  • You said at least 3, so I would just subtract those with 1 (if you don't count the root) or 2 vertices of degree 1. Is the root identified? – Ross Millikan Oct 01 '13 at 18:48
  • I re-read the problem, it's actually exactly three vertices of degree 1, not at least three. We haven't talked about roots so I guess it isn't identified. I edited the question appropriately. – walkar Oct 01 '13 at 18:50

5 Answers5

3

Here's a way to find the number. It looks like it might not be the best (Sloane's A055315 has other formulas), but it works.

Let $n$ be the number of vertices and $e=n-1$ be the number of edges.

Claim: There is exactly one vertex of degree $3$, all others have degree $2$ or $1$. (Assume otherwise, and we violate the Handshaking Lemma, which stipulates the sum of degrees is $2e=2(n-1)$.)

So, the trees look like this:

enter image description here

If we delete the degree-$3$ vertex, we obtain three components. These three components only have vertices of degree $1$ and $2$, and so must be paths. Suppose the paths have $a$, $b$ and $c$ vertices. Then $a+b+c=n-1$ and $a,b,c$ are all positive integers. Conversely, given three paths of lengths $a \geq 1$, $b \geq 1$ and $c \geq 1$ and $a+b+c=n-1$, we can join their endpoints to a new vertex to create an $n$-vertex tree with exactly three $3$ leaves.

Let $a(n)$ be the number of partitions of $n-1$ into $3$ non-zero parts; this is equivalent to Sloane's A001399 which includes the formula $$a(n)=1+\left\lfloor\frac{(n-1)^2+6(n-1)}{12}\right\rfloor$$ among others.

Given an unlabeled tree, we can label the vertices in $n!$ (not necessarily distinct) ways. In this way, we generate $a(n)\ n!$ labeled trees.

In some cases (not many), there are symmetries which need to be accounted for. Because of symmetry, in this case

enter image description here

we count every labeling twice. This happens whenever $\{a,b,c\}$ have two parts of the same size.

And in this case

enter image description here

we count every labeling six times. This happens when $\{a,b,c\}$ has all three parts of the same size.

In these cases, we'll need to add a correction.

  • In the first case: we subtract $$\sum_{a \geq 1:n-1-a \text{ is even and } \geq 2} \tfrac{1}{2}n!=\frac{\lfloor (n-2)/2 \rfloor\ n!}{2}$$ since we have double-counted the $\frac{1}{2} n!$ graphs with $b=c=\tfrac{n-1-a}{2}$.

  • In the second case: if $n-1 \equiv 0 \pmod 3$, we first "uncorrect" the first correction, so we add back in $\tfrac{1}{2}n!$ and then subtract $\frac{5}{6}n!$ since we originally counted six times the $\frac{1}{6} n!$ graphs with $a=b=c$.

This gives $$\begin{cases} a(n)\ n!-\tfrac{\lfloor (n-2)/2 \rfloor\ n!}{2} & \text{if } n-1 \not\equiv 0 \pmod 3 \\ a(n)\ n!-\tfrac{\lfloor (n-2)/2 \rfloor\ n!}{2}+\tfrac{1}{2}n!-\tfrac{1}{6} n! & \text{if } n-1 \equiv 0 \pmod 3. \end{cases}$$ in agreement with Sloane's A055315.

  • Thanks for your answer! I think this makes a lot of sense, but it seems like there would be other kinds of trees than the kind you present (like a Y model where you have a line of n-2 vertices and at the last vertex you attach two vertices of degree 1) and I don't know how to abstract it to every possible case for tree designs. – walkar Oct 01 '13 at 19:27
  • The unlabeled tree designs correspond to the partitions of $n-1$ into $3$ non-zero parts (the parts are the component sizes when the degree-$3$ vertex is deleted). So, in the case you mention, it corresponds to the partition $(n-3)+1+1$. – Rebecca J. Stones Oct 01 '13 at 19:33
  • So, we need to partition n-1 into 3 non-empty parts, and then we've counted the unlabeled trees, and then we need to label them, which is n! ways, but there's some overcounting there so we need to subtract some. I'm still not sure exactly how we can remove the overcounting for a general value of n, sorry. – walkar Oct 01 '13 at 19:42
  • I'll fill in a bit more detail (give me a moment). – Rebecca J. Stones Oct 01 '13 at 19:54
2

Here is a solution that is remarkably compact and uses exponential generating functions. First, the claim that the maximum vertex degree is three and there is only one vertex of degree three. Suppose there were a vertex of degree at least four. But there are four subtrees attached to that vertex, each contributing at least one leaf, giving at least four leaves, a contradiction. Now suppose there were at least two vertices of degree three. Pick two of them, connected by a path. That leaves two subtrees attached to each vertex and not on the path, again producing at least four leaves, a contradiction. This proves the claim, which was also done by Rebecca.

Second, introduce the combinatorial species $\mathcal{L}$ consisting of oriented chains. Then the combinatorial class $\mathcal{T}_3$ being counted in this problem is

$$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}}\mathcal{T}_3 =\mathcal{Z}\times\textsc{SET}_{=3}(\mathcal{L_{\ge 1}(\mathcal{Z})}).$$

Translating to generating functions and letting the generating function of $\mathcal{L}_{\ge 1}(\mathcal{Z})$ be $L(z)$ this gives the generating function $$T_3(z) = \frac{1}{3!} z L(z)^3.$$

But there are $k!$ oriented chains on $k$ nodes, giving $$L(z) = \sum_{k\ge 1} k! \frac{z^k}{k!} = \frac{z}{1-z}.$$ Therefore $$ T_3(z) = \frac{1}{3!} z \left(\frac{z}{1-z}\right)^3.$$ Extracting coeffcients we obtain for $n\ge 4$, which is the count where this generating function starts, $$ n! [z^n] T_3(z) = n! [z^n] \frac{1}{3!} z^4 \left(\frac{1}{1-z}\right)^3 = n! \frac{1}{3!} [z^{n-4}] \left(\frac{1}{1-z}\right)^3 \\= \frac{1}{6} n! [z^{n-4}] \sum_{k\ge 0} {k+2 \choose 2} z^k = \frac{1}{6} n! {n-2 \choose 2}.$$

Marko Riedel
  • 64,728
  • This looks like a very sophisticated way to handle the problem and I appreciate your answer but I think we're not supposed to use generating functions yet as the problem makes reference to "easier ways to do this in chapter 6" and chapter 6 is about generating functions. Thanks a ton though! – walkar Oct 02 '13 at 01:16
2

I would recommend looking at the Prüfer code of the tree. You should know something special about degree one vertices and their involvement in the code!

azimut
  • 24,316
user98724
  • 33
  • 3
1

Adding to Rebecca's answer: It is easier to consider the compositions of $n-1$ into three parts, which are the ordered partitions. Think of them being (in order) the length of each horizontal line. There are ${n-2 \choose 2}$ of these. Each of them can be labeled in $n!$ ways. Then (regardless of whether some lengths are the same) after the labeling, there are $6$ ways to show any given tree. So the total number is $\frac 16n!{n-2 \choose 2}=\frac 1{12}(n-2)(n-3)n!$

Ross Millikan
  • 383,099
-1

In fact, the problem can be solved by Prufer code only. Consider first we choose $3$ nodes, they are not in Prufer code and there are $C(n,3)$ ways to choose. Then for last $n-3$ nodes, they must be in the code. It's easily to find that only one of them show 2 times and the other shows exactly one times. Then we can choose the position for the 2 times' number , there are $(n-3)C(n-2,2)$ ways, for the last $n-4$ numbers, we have $(n-4)!$ ways to arrange them. As all above, we have $C(n,3)(n-3)C(n-2,2)(n-4)!$ such trees. You can simplify the result, it is same to the other answers.

feng
  • 1