0

I'm trying to make the list of all 2-connected subcubic graphs with at most N vertices.

I tried this code:

GraphData[All, "Preload"]
Select[GraphData[7], (GraphData[#, "EdgeChromaticNumber"] == 3 && GraphData[#, "VertexConnectivity"] >= 3) &]

I found this code here, but it gave me the next error:

error

Can somebody help me?

Rk. N can be fixed at the beginning, we would like to take N as big as possible as long as the computation is still feasible.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Debbie
  • 1
  • 1
  • 4
    You mean an exhaustive list, for 100 points? That is unreasonable. There will be more such graphs than what could fit in the memory of all computers in the world, combined. – Szabolcs Mar 21 '20 at 11:29
  • 2
    Please formulate the problem precisely, so people will not spend time creating solutions that you will not find useful. You talk about vertex connectivity, but the code you show deal with edge chromatic numbers. It's unclear how many such graphs you want (it's easy to make as many as you want as basically all sufficiently dense random graphs will be 3-connected). – Szabolcs Mar 21 '20 at 11:31
  • Thanks for the edit, but it still has not answered the questions I raised ... – Szabolcs Mar 21 '20 at 12:32
  • I wrote a code I need to test on as many 3-connected graphs with degree at most 3 in each vertice and a maximum amount of points. My mentor suggested I try it for 100 vertices, but if you think this is impossible, I could also try less. I'm not very skilled in Mathematica so I tried the code I found there, but as you pointed out it is wrong. What questions do you still have that I didn't answer in the edit? – Debbie Mar 21 '20 at 16:37
  • (1) Do you want all such graphs? The question reads as if you did, but that is impossible. Or do you just want a few such graphs? (2) Why do you filter by EdgeColoringNumber in the sample code? (3) Please list all constraints that your graphs must satisfy, to avoid any doubts (4) You say "degree at most 3", but if there is a vertex with degree < 3 then the graph cannot be 3-vertex-connected. Did you mean 3-regular graphs? – Szabolcs Mar 21 '20 at 17:49
  • Can you edit the question and ensure that all 4 points I mentioned above are addressed? – Szabolcs Mar 21 '20 at 17:49
  • @Szabolcs I have tried to modify the question, but my edit was rejected. The "100" is not important, you can replace 100 with some smaller N for which the computation is still feasible. However, we are interested in listing ALL 2-connected subcubic graphs on at most N vertices. – Maurizio Moreschi Mar 21 '20 at 18:21
  • 2
    @MaurizioMoreschi geng from the nauty suite can do this, if you want 2-connected. But Debbie said 3-connected. It makes a big difference. – Szabolcs Mar 21 '20 at 18:58
  • @MaurizioMoreschi I dug your edit out of the edit review queue and have inserted it into the OP. The reviewers may not have seen your comment that you discussed with Debbie before editing. – Szabolcs Mar 21 '20 at 19:01
  • @Szabolcs We want 2-connected, she got confused on that point. As she explained we need to test some function on the element of the list, so it is important that Mathematica can see all the elements of the list properly as graphs. – Maurizio Moreschi Mar 21 '20 at 19:10
  • @MaurizioMoreschi Please see my answer and let me know if it's what you needed. – Szabolcs Mar 21 '20 at 19:10
  • @Szabolcs Yes, thank you. – Maurizio Moreschi Mar 21 '20 at 19:16

1 Answers1

3

Since there was a lot of confusion about the OP's requirements, I am going to repeat the problem:

Exhaustively generate all non-isomorphic biconnected graphs with maximum degree 3 on $n$ vertices, for as large an $n$ as feasible.

I highly recommend using the geng tool from the nauty suite. You will need to compile this collection of programs yourself, but it is very easy to do it on Mac or Linux.

geng outputs the result in the graph6 format. Mathematica can import this format using the built-in Import, but I highly recommend that you use IGImport from my IGraph/M package instead. It will give a ~3x speedup. The bottleneck will unfortunately still be the importing, not running geng itself.

We set these geng options (see geng -help): -C for biconnected, -d2 for minimum degree 2 (since we want biconnected) and -D3 for maximum degree 3.

There are 165,993 such graphs on 15 vertices and it took ~15 seconds to generate and import them on my machine.

IGImport["!/opt/local/bin/geng 15 -d2 -D3 -C", "Graph6"] // Length // AbsoluteTiming
(* {14.9616, 165993} *)

For 14 vertices,

IGImport["!/opt/local/bin/geng 14 -d2 -D3 -C", "Graph6"] // Length // AbsoluteTiming
(* {3.82645, 43418} *)

These timings should give a hint about how large an $n$ is feasible.

In the command above, I wrote the full path to the geng executable on my computer. This will be different on yours: adjust it. Note the ! before the executable: this tells Import to execute the command and import whatever it outputs.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263