I'm working on a graph theory problem, and given $n$ vertices, I would like to be able to generate all non-isomorphic connected graphs (not necessarily simple) with $n$ vertices, each having degree 3. Currently I'm doing the graph finding in Sage, but the included graph packages have given me problems, so I've used dictionaries instead. My approach is to generate graphs with vertex degree at most three, and recurse on previous such lists, increasing edge number by 1 each time. This is not optimal, and is really time-intensive, mostly because of my primitive isomorphism-checking function.
So, I would like to know if it is possible to generate this type of list (connected graphs with maximal degree at most 3) in Mathematica, because I can actually plot them there easily as well. I've been using a converter (line 46 here) that gives the Mathematica command to plot the graphs from Sage, for example,
{GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 2 -> 3}],
GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 2 -> 4}],
GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 3 -> 3}],
GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 3 -> 4}],
GraphPlot[{1 -> 2, 1 -> 2, 1 -> 3, 2 -> 3}],
GraphPlot[{1 -> 2, 1 -> 2, 1 -> 3, 2 -> 4}],
GraphPlot[{1 -> 2, 1 -> 2, 1 -> 3, 3 -> 4}],
GraphPlot[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 3}],
GraphPlot[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 5}],
GraphPlot[{1 -> 2, 1 -> 3, 2 -> 4, 3 -> 4}],
GraphPlot[{1 -> 2, 1 -> 3, 2 -> 4, 3 -> 5}]}
gives all the graphs with 4 edges and vertices of degree at most 3. Any help in this regard would be appreciated. For the past two hours Sage has been computing all such graphs with 5 edges, and I would like at least 9-edge graphs, so things are not looking hopeful in that direction.
Maybe there are nice packages to do this with? I've looked at Combinatorica, but the graph-manipulating functions don't seem well-suited to my needs, though that is from a cursory inspection.
GraphData[n]
enumerates all then
-vertex simple graphs. It only works up to $n=7$, though. To see the available graphs whose vertices all have degree 3, tryGraphData["Cubic"]
. $\endgroup$IGKRegularGame
which generates such graphs randomly. $\endgroup$