Do we have a closed form formula for counting undirected 2-regular labelled graphs ? The sequence for there enumeration is given here.
-
2A finite $2$-regular graph is a disjoint union of cycles, so the number of $2$-regular graphs on $n$ vertices is the number of partitions of $n$ into parts at least $3$. – saulspatz Apr 27 '21 at 14:56
-
@saulspatz does partitioning n into parts of size atleast 3 has a closed form ? – SagarM Apr 27 '21 at 15:07
-
@saulspatz I am sorry I realised what I was trying to get an answer for what are called labelled graphs. – SagarM Apr 27 '21 at 15:29
-
1Do you mean labelled $2$-regular graphs? – saulspatz Apr 27 '21 at 15:32
-
Yes, again apologies for the mistake. – SagarM Apr 27 '21 at 15:37
-
1Are these graphs directed or not? – Marko Riedel Apr 27 '21 at 17:59
-
The graphs are undirected – SagarM Apr 27 '21 at 18:03
-
1Okay thanks that is what the OEIS says too. – Marko Riedel Apr 27 '21 at 18:03
-
1@SagarM Please add the clarifications to your question post so that the post is complete and doesn't need clarification for anyone who reads it completely. – Sarvesh Ravichandran Iyer Apr 28 '21 at 18:40
-
Your number is just the number of permutations without fixed points or two cycles. – Igor Rivin Apr 27 '21 at 16:12
-
$$\sum_{k=0}^{n}\sum_{i=0}^{k} \frac{ {k\choose i }{(i- \frac{1}{2})\choose n-k }(3^{k-i}n!)(-1)^{n-i}}{4^{k}k!}$$ PS:I don’t know why this formula is given as a Maxima code in the OEIS page and not as a formula. – SagarM Apr 29 '21 at 14:47
2 Answers
Initially the question said "$2$-regular graphs". It was changed to labelled graphs after I had written this answer. So, the first part of the answer addresses unlabelled graphs, and the second part (after the EDIT) explains why I think it would be hard to extend this to labelled graphs.
A finite $2$-regular graph is a disjoint union of cycles, so the number of $2$-regular graphs on n vertices is the number of partitions of n into parts of size$\geq 3$.
As far as I can determine, there isn't a closed form known for this. At least, I haven't found one by searching the Web. One can give a generating function of course. If $Q(n)$ is the number of partitions of $n$ into parts of size $\geq3$ then $Q(n)$ is the coefficient of $x^n$ in $$\prod_{k=3}^\infty\frac1{1-x^k}=(1-x)(1-x^2)\prod_{k=1}^\infty\frac1{1-x^k}$$
The last infinite product is the generating function for the ordinary partition function, so if $p(n)$ is the number of partitions of $n$, then $$Q(n)=p(n)-p(n-1)-p(n-2)+p(n-3)$$
We can also see this by inclusion and exclusion. To get the partitions into parts $\geq3$ we must exclude the partitions with a $1$ and the partitions with a $2$, but the partitions with both a $1$ and a $2$ must be added back in.
A recursive formula for the partition formula is known of course. (See the last section these notes.)
EDIT
Offhand, the case of labelled graphs sounds harder. Take the $n=8$ case. There are three $2$-regular graphs: $$C_8\\ C_4\cup C_4\\ C_5\cup C_3$$ where $C_k$ is a $k$-cycle. There are $\frac{7!}2$ labelled graphs corresponding to the first case. For the second case, there $\binom84$ ways to choose the labels of the first cycle, and then $(3)^2$ ways to label the vertices, but we must divide by $2$, to take account of isomorphism of the two cycles, so $\frac 12\binom84(3)^2$ labellings. In the third case, we have $\binom83\cdot12$ labellings.
This approach would require listing all the partitions of parts of size $\geq3$.

- 53,131
-
thanks alot for the answer, but I realised that my question is regarding the labelled graphs case. I am sorry for this confusion, but do you have inkiling about those cases too ? – SagarM Apr 27 '21 at 15:34
-
1Well but wait....the ordering within each part matters. For example suppose $n=4$. Then the 4-cycle $14321$ is distinct from $13421$. – Mike Apr 27 '21 at 16:08
-
2@Mike The answer was written before the OP changed the question from $2$-regular graphs to $2$-regular labelled graphs. The edit addresses labelling. – saulspatz Apr 27 '21 at 16:11
-
-
1@Mike No apology necessary. I ought to edit the answer to make things plain. – saulspatz Apr 27 '21 at 16:13
-
@saulspatz On a re-reading of the OEIS page mentioned in the link, I did find a formula mentioned in the PROG section, which is a double summation (but qualifies as closed form in my books, as they are finite sums upto $n$). I am just amazed that I am not able to find any publication regarding this. – SagarM Apr 27 '21 at 16:16
-
1@SagarM I didn't really understand the formula. Exact formulas for the partition number are known. See https://people.math.rochester.edu/grads/asahay/iitd.pdf Since the answer is known to be an integer, one need'nt make the remainder very small to get the answer. Perhaps the program has something to do with that. Also, Bringmann and Ono give an arithmetic formula for the partition function, but I don't begin to understand it. – saulspatz Apr 27 '21 at 16:34
-
We can construct a recurrence for these numbers. Using combinatorial classes we have the following class $\mathcal{Q}$ of sets of undirected cycles of length at least three:
$$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}} \mathcal{Q} = \textsc{SET}( \textsc{DHD}_{=3}(\mathcal{Z}) + \textsc{DHD}_{=4}(\mathcal{Z}) + \textsc{DHD}_{=5}(\mathcal{Z}) + \cdots).$$
This gives the EGF (the dihedral group $D_n$ has order $2n$)
$$Q(z) = \sum_{n\ge 0} Q_n \frac{z^n}{n!} = \exp\left( \frac{1}{2} \frac{z^3}{3} + \frac{1}{2} \frac{z^4}{4} + \frac{1}{2} \frac{z^5}{5} + \cdots\right) \\ = \exp\left(- \frac{z}{2} - \frac{z^2}{4} + \frac{1}{2} \log\frac{1}{1-z}\right) = \frac{\exp(-z/2-z^2/4)}{\sqrt{1-z}}.$$
Differentiating we find
$$Q'(z) = - \frac{1}{2} (1+z) \frac{\exp(-z/2-z^2/4)}{\sqrt{1-z}} + \frac{1}{2} \frac{1}{1-z} \frac{\exp(-z/2-z^2/4)}{\sqrt{1-z}}.$$
Extracting the coefficient on $[z^{n-1}]$ for $n\ge 2$ on both sides yields
$$\frac{Q_n}{(n-1)!} = - \frac{1}{2} \frac{Q_{n-1}}{(n-1)!} - \frac{1}{2} \frac{Q_{n-2}}{(n-2)!} + \frac{1}{2} \sum_{m=0}^{n-1} [z^m] \frac{\exp(-z/2-z^2/4)}{\sqrt{1-z}} \\ = - \frac{1}{2} \frac{Q_{n-1}}{(n-1)!} - \frac{1}{2} \frac{Q_{n-2}}{(n-2)!} + \frac{1}{2} \sum_{m=0}^{n-1} \frac{Q_m}{m!} = \frac{1}{2} \sum_{m=0}^{n-3} \frac{Q_m}{m!}.$$
This gives the recurrence
$$\bbox[5px,border:2px solid #00A000]{ Q_n = \frac{(n-1)!}{2} \sum_{m=0}^{n-3} \frac{Q_m}{m!}.}$$
with base cases $Q_0=1$ and $Q_1=0.$ To simplify this further we introduce for $n\ge 3$
$$Q_{n-1} = \frac{(n-2)!}{2} \sum_{m=0}^{n-4} \frac{Q_m}{m!}$$
and get
$$Q_n = \frac{(n-1)!}{2} \left(\frac{2}{(n-2)!} Q_{n-1} + \frac{Q_{n-3}}{(n-3)!}\right)$$
which yields
$$\bbox[5px,border:2px solid #00A000]{ Q_n = (n-1) Q_{n-1} + \frac{1}{2} (n-1)(n-2) Q_{n-3}}$$
for $n\ge 3$ with base cases $Q_0=1, Q_1=0$ and $Q_2=0.$ This will produce the sequence
$$1, 0, 0, 1, 3, 12, 70, 465, 3507, 30016, 286884, \ldots$$
which points us to OEIS A001205 where we find the EGF and the recurrence, so the above is sound.
Addendum. If we ask for a closed form we get e.g.
$$\begin{align*} & n! [z^n] \frac{\exp(-z/4(z+2))}{\sqrt{1-z}} = n! [z^n] \sum_{k=0}^n \frac{1}{k!} \frac{(-1)^{k}}{4^{k}} z^{k} (z+2)^{k} \frac{1}{\sqrt{1-z}} \\ & = n! \sum_{k=0}^n \frac{1}{k!} \frac{(-1)^k}{4^k} [z^{n-k}] (z+2)^k \frac{1}{\sqrt{1-z}} \\ & = n! \sum_{k=0}^n \frac{1}{k!} \frac{(-1)^k}{4^k} \sum_{j=0}^{n-k} {k\choose n-k-j} 2^{2k+j-n} \frac{1}{4^j} {2j\choose j}. \end{align*}$$
We obtain
$$\frac{n!}{2^n} \sum_{k=0}^n \frac{(-1)^k}{k!} \sum_{j=0}^{n-k} \frac{1}{2^j} {k\choose n-k-j} {2j\choose j}.$$
This is one of several possibilities.
Remark. Wilf in generatingfunctionology page 180 gives a proof for the asymptotic
$$Q(n) \sim n! \exp(-3/4) {n-1/2\choose n} = \exp(-3/4) (n-1/2)^{\underline{n}}.$$
This can be further simplified to
$$Q(n) \sim \frac{n! \exp(-3/4)}{\sqrt{n\pi}}.$$

- 61,317