[Math] How many trees on N vertices have exactly k leaves

combinatoricsgraph theorytrees

I need help on the topic of counting labeled trees (with its nodes numbered from 1 to N) with exactly k leaves.

I have thought about surjective functions that return the father of a node, but I'm not sure how to count all of them that give me correct trees.

Here is the source of the question: http://www-math.mit.edu/~djk/18.310/Lecture-Notes/counting_trees.html and it's not explained in this paper.

I would be very greatful if anyone could help me with a formula and, even more important, an explanation.

Thank you!

Best Answer

In the proof of Cayley's $n^{n-2}$ formula for each labeled tree on $n$ vertices a code word on $[n]$ of length $n-2$ is generated. A vertex is a leaf iff it does not appear in this code word. You therefore have to count the number of code words in which exactly $n-k$ different numbers appear. The result can be expressed in terms of Stirling numbers.

Related Question