Find the expected degree of the root of
- Cayley trees
- Catalan trees
I want to do this with probability generating functions, aka PGFs. Here is what I got so far:
- Let $\mathcal{C}$ be the class of rooted acyclic connected graphs, a.k.a. Cayley trees (non-plane rooted labelled trees), and let $X$ denote the degree of the root. Then we have
$$\mathcal{C} = \mathcal{A} \times \text{SET}\left( u\mathcal{C} \right)$$ and $$C(z,u) = z \exp(uC(z,1)).$$ Then the expected degree of the root in a random Cayley tree on $n$ vertices is given by
$$\mathbb{E}[X] = \frac{1}{[z^n]C(z,1)} [z^n] \frac{\partial}{\partial u} C(z,u) \bigg\vert_{u=1} = \ldots$$
However, I do not see how to go on from here. I know that $$[z^n]C(z) = n^{n-1},$$ so $C_n$ is the $n$-th Cayley number. However, I do not see what to do with the term $[z^n] \frac{\partial}{\partial u} C(z,u) \bigg\vert_{u=1}$.
- Let $\mathcal{P}$ be the class of rooted acyclic connected plane graphs, a.k.a. Catalan trees (a.k.a. plane rooted trees), and let $X$ denote the degree of the root. Then we have
$$\mathcal{P} = \mathcal{A} \times \text{SET}\left( u\mathcal{P} \right)$$ and $$P(z,u) = z \exp(uP(z,1)).$$ Then the expected degree of the root in a random Catalan tree on $n$ vertices is given by
$$\mathbb{E}[X] = \frac{1}{[z^n]P(z,1)} [z^n] \frac{\partial}{\partial u} P(z,u) \bigg\vert_{u=1} = \ldots$$
Again, I do not see how to go on from here. I know that $$[z^n]P(z) = \frac{1}{n} \cdot {{2n-2}\choose{n-1}},$$ but I do not see what to do with the term $[z^n] \frac{\partial}{\partial u} P(z,u) \bigg\vert_{u=1}$. However, I know that $P(z) = \frac{1-\sqrt{1-4z}}{2}$.
Could you please help me?
For Cayley trees let us recall the combinatorial class equation
$$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}} \mathcal{T} = \mathcal{Z} \times \textsc{SET}(\mathcal{T}).$$
which gives the functional equation
$$T(z) = z \exp T(z).$$
Marking the root degree we get
$$\mathcal{Z} \times \mathcal{U}^0 \textsc{SET}_{=0}(\mathcal{T}) + \mathcal{Z} \times \mathcal{U}^1 \textsc{SET}_{=1}(\mathcal{T}) + \mathcal{Z} \times \mathcal{U}^2 \textsc{SET}_{=2}(\mathcal{T}) + \cdots$$
This gives the generating function
$$R(z, u) = z \sum_{k\ge 0} u^k \frac{T(z)^k}{k!} = z \exp(u T(z)).$$
As a sanity check put $u=1$ to get $z \exp T(z)$ which is correct. Differentiate and put $u=1$ to obtain
$$\left.\frac{\partial}{\partial u} R(z, u)\right|_{u=1} = \left. z \exp(u T(z)) T(z) \right|_{u=1} = z \exp(T(z)) T(z) = T(z)^2.$$
Now using Lagrange inversion by residues (Egorychev method) we seek
$$n! [z^n] T(z)^2 = (n-1)! [z^{n-1}] 2 T(z) T'(z) = (n-1)! \;\underset{z}{\mathrm{res}}\; \frac{1}{z^n} 2 T(z) T'(z).$$
Next put $T(z)=w$ to get with $z= w \exp(-w)$
$$(n-1)! \;\underset{w}{\mathrm{res}}\; \frac{\exp(nw)}{w^n} 2w = 2 (n-1)! [w^{n-2}] \exp(nw) = 2 (n-1)! \frac{n^{n-2}}{(n-2)!} \\ = 2 (n-1) n^{n-2}.$$
It follows that the average degree of the root is
$$\bbox[5px,border:2px solid #00A000]{ 2 \frac{n-1}{n}.}$$
This also works for $n=1.$
The above result can be verified using the combstruct package, see below.
with(combinat); with(combstruct); trees := proc(n) option remember; local spec, k, res; res := 0; for k to n-1 do spec := { T1= Prod(Z, Set(T1)), Z=Atom, T2 = Prod(Z, Set(T1, card=k))}; res := res + k*count([T2, spec, labeled], size=n); od; res/n^(n-1); end;