I'm trying to get a list of regular graphs on 12 vertices in g6 format.
I've spent a few days trying to unscramble the data at the
Regular Graphs Page, but I can't unscramble the shortcode format.
Also, with my limited linux experience, I've had no luck getting genreg to run.
Specifically, I need the 1544 4-regular and 7848 5-regular graphs on 12 vertices.
The 10778 4-regular graphs would also be nice.
2026-03-27 03:45:24.1774583124
On
Connected Regular Graphs on 12 vertices.
207 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
I think Misha Lavrov's answer is excellent. Here I offer an alternative.
It also seems to handle generating regular graphs quickly. For exmaples, there are 1547 4-regular 12-vertex graphs (including 1544 connected graphs and 3 disconnected graphs)
geng 12 -d4 -D4 -g
Only consider connected graphs.
geng 12 -d4 -D4 -g -c
Similar to Misha Lavrov, we can also import them with Mathematica, but the speed is mostly lost in the import process. But for the size of the data here, it's pretty fast.
S = Import["!D:/nauty27r3/geng 12 -d4 -D4 ", "Graph6"]; // AbsoluteTiming
{0.966699, Null}
According to the GENREG manual, the shortcode files do three things:
This encodes a sequence of graphs as a (longer) sequence of integers; the
.scdfile has one integer per byte.Here is some Mathematica code that undoes all of these steps:
In reverse order,
parseShortCodeparses the bytes of an.scdfile, wheresplitAdjacencyListfigures out how to split up an adjacency list by vertex, andadjcencyListGraphturns the result into a graph. Note thatparseShortCodeneeds to know $n$ (the number of vertices in a graph) and $d$ (the degree of each vertex) to parse the file.For example, we can read the $3$-regular connected graphs on $10$ vertices:
This gives a list of Mathematica graphs, which we can then export as a Graph6 string if we like. (Even for the $10778$ four-regular graphs on $13$ vertices, importing the graphs takes less than a second.)