Counting unlabeled and non-uniquely labeled trees

852 Views Asked by At

I recently learned about Cayley's formula, which states that the number of trees on $n$ labeled vertices is $n^{n-2}$. As I understand it, this works because we can prove that there are $n^{n-2}$ Prüfer codes for $n$ labeled vertices that each map to exactly one tree with $n$ labeled vertices.

However, I'm not sure how to generalize this idea of mapping Prüfer codes to trees when there are conditions placed on how each vertex in the tree may appear. For example, I have encountered a problem where, on $n$ labeled vertices, I can only have some number $k$ vertices that are not leaves (I suppose this question could also be asked if the vertices were not labeled as well).

My idea was that, at least for a question that involves labeled vertices, I could still consider Prüfer codes. The possibilities for the numbers that could be present in the code would be limited to those $k$ vertices that could not be leaves (yet I realize that some of these non-leaves could be included in the code after all leaves were removed). To keep it simple, if $k=2$, then I believe that there would be $\binom n 2$ $2^{n-2} - 2$ trees on $n$ labeled vertices, since there are 2 possibilities for each of the $n-2$ spots in the code, but two of these codes are impossible (where the code is filled either of the same non-leaf numbers). I think I could manage to generalize that in this way.

For the unlabeled trees, I think this kind of goes out the window. Any ideas for that?