I can easily work out that the number of functional graphs (directed graphs in which all vertices have out-degree one) of size $n$ is $n^n$ and the number of functional graphs without one-cycles is ${(n-1)}^n$. Is there an straight-forward way to work out the number of functional graphs of size $n$ which have no 1-cycles (fixed points) or 2-cycles?
-
I've just realized that this is on math.stackexchange. Anyway, I've written up a proof (using inclusion-exclusion) for my combinatorics class a while ago: See Exercise 3 in UMN Fall 2017 Math 4990 homework set #4. The sequence obtained is A134362 in the OEIS. – darij grinberg Oct 10 '18 at 18:05
2 Answers
The problem of restricted endofunctions is a classic from combinatorics, gives rise to some fascinating deep math and has been studied in considerable detail.
Labelled trees are given by $$\mathcal{T} = \mathcal{Z} \times \mathfrak{P}(\mathcal{T})$$ which gives the functional equation $$T(z) = z \exp T(z).$$
The species of endofunctions is then given by $$\mathcal{Q} = \mathfrak{P}(\mathfrak{C}(\mathcal{T})).$$
Translating to generating functions we get $$Q(z) = \exp \log \frac{1}{1-T(z)} = \frac{1}{1-T(z)}.$$
In this particular case we have that there are no fixed points or two-cycles so we get the species
$$\mathcal{Q} = \mathfrak{P}(\mathfrak{C}_{\ge 3}(\mathcal{T})).$$
This yields the generating function
$$Q(z) = \exp \left(-T(z)-T(z)^2/2\right) \frac{1}{1-T(z)}.$$
Extracting coefficients via poor man's Lagrange inversion we have $$Q_n = n! \frac{1}{2\pi i} \int_{|z|=\epsilon} \frac{1}{z^{n+1}} \exp\left(-T(z)-T(z)^2/2\right) \frac{1}{1-T(z)} dz.$$
Put $T(z)=w$ so that $z=w/\exp(w) = w\exp(-w)$ and $dz = \exp(-w) - w\exp(-w)$ to get $$n! \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{\exp(w(n+1))}{w^{n+1}} \frac{\exp(-w-w^2/2)}{1-w} (\exp(-w) - w\exp(-w)) dw \\ = n! \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{\exp(wn)}{w^{n+1}} \frac{\exp(-w-w^2/2)}{1-w} (1 - w) dw \\ = n! \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{\exp(w(n-1)-w^2/2)}{w^{n+1}} dw.$$
Extracting coefficients from this we obtain the closed formula
$$n! \sum_{q=0}^{\lfloor n/2 \rfloor} \frac{(-1)^q}{2^q \times q!} \frac{(n-1)^{n-2q}}{(n-2q)!}.$$
This yields the following sequence which we have started at index one to make things clear:
$$0, 0, 2, 30, 444, 7360, 138690, 2954364, 70469000, 1864204416, \\ 54224221050, 1721080885480, 59217131089908, 2195990208122880,\ldots$$
This is OEIS A134362 where we find confirmation of the above analysis as well as many useful links.
Finally note that this MSE link I and this MSE link II may prove useful reading.
- 65,136
- 5
- 68
- 147
-
Thank you. You have raised my interest in analytic combinatorics. Clearly I have some reading to do. – CommonerG Mar 08 '16 at 22:31
(I apologize, I'm not very adept at LaTeX formatting)
There's a simpler way to understand this question using the principle of inclusion-exclusion. If we count the number of graphs with no two-cycles, with 1 or more two cycles, with 2 or more two cycles, etc, an alternating sum will leave us with only the graphs with no two-cycles.
Read more about PIE here: https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle
So, we must take an alternating sum over the number of possible pairs, which gives us
$$\sum_{p=0}^{\lfloor n/2 \rfloor}(-1)^p$$
Then, for each p, we need to figure out how many combinations have that number of pairs or more.
We start by "choosing" the first pair, then the second, etc. We also divide by $p!$ because order doesn't matter: $$\frac{\binom{n}{2}\binom{n-2}{2}\dots}{p!}$$
Expanding each choose function, we get a telescoping product:
$$\frac{\frac{n!}{2!(n-2)!}\cdot\frac{(n-2)!}{2!(n-4)!}\dots}{p!} = \frac{n!}{(n-2p)! 2^p p!}$$
Then, we can let the remaining nodes make any connection. Each node has $n-1$ choices, and there are $n-2p$ nodes left:
$$(n-1)^{n-2p}$$
Stringing it all together, we get the same formula of $$n!\sum_{p=0}^{\lfloor n/2 \rfloor}\frac{(n-1)^{n-2p}}{(n-2p)! 2^p p!}(-1)^p$$