Enumerating dis-connected regular graphs

61 Views Asked by At

Question

How can I enumerate all dis-connected k-regular graphs on n vertices?

What I tried

Meringer's GENREG code enumerates connected k-regular graphs. I looked over his C code but did not see an easy way to include dis-connected graphs.

Edit #1

dis-connected here means not connected. For example, one solution for the graph with 6 vertices and degree 2 is two triangles. The adjacency list for that would be:

1: 2,3

2: 1,3

3: 1,2

4: 5,6

5: 4,6

6: 4,5

2

There are 2 best solutions below

0
On BEST ANSWER

I was able to generate this using the geng utility from the nauty program. The commands and output are below. The first solution is a "circle of nodes" and the second is "two triangles".

$ nauty26r11/geng.exe 6 -d2D2 > n6d2.g6
>A nauty26r11/geng -d2D2 n=6 e=6
>Z 2 graphs generated in 0.00 sec

$ cat n6d2.g6
EEh_
EQhO

$ nauty26r11/showg.exe ./n6d2.g6

Graph 1, order 6.
  0 : 3 4;
  1 : 3 5;
  2 : 4 5;
  3 : 0 1;
  4 : 0 2;
  5 : 1 2;

Graph 2, order 6.
  0 : 2 4;
  1 : 3 5;
  2 : 0 4;
  3 : 1 5;
  4 : 0 2;
  5 : 1 3;
0
On

I'm not sure precisely what your definition of dis-connected is, but since edgeless graphs are only $k$-regular for $k=0$ it must either be

  1. All graphs which are not connected, or
  2. All graphs.

Either way, Riddell's formula is the name given to the transform which maps the generating function for connected graphs having suitable property $P$ to all graphs which have property $P$. For unlabelled graphs it's the Euler transform $$1 + \sum_{n=1}^\infty b_n x^n = \prod_{i=1}^\infty \frac{1}{(1-x^i)^{a_i}}$$ where $a_i$ is the number of connected graphs with $i$ vertices and property $P$, and $b_i$ is the number of all graphs with $i$ vertices and property $P$.

An alternative way of thinking of it, which is probably more useful computationally, is that the graphs on $n$ vertices can be enumerated by considering the partitions of $n$ into integers $\lambda_1, \lambda_2, \ldots, \lambda_k$ and then for each such partition taking the Cartesian product $C_{\lambda_1} \times C_{\lambda_2} \times \cdots \times C_{\lambda_k}$ where $C_i$ is the set of connected graphs with $i$ vertices and property $P$. (NB Specifically you want the Cartesian product to give you a multiset, because the connected components are not necessarily distinct).