Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • $\begingroup$ The number of such graphs is given here, for N=9 it's only 261080, this should be manageable. The code in the linked answer is brute force, generating a significantly larger number of graphs and then filtering, which is where the problem lies. Unfortunately I don't know how to generate just the graphs you are looking for, but maybe the link is helpful. $\endgroup$ Commented Jun 6 at 6:02
  • 1
    $\begingroup$ Do you want labelled graphs (as in the question you linked to)? If so, there's probably too many of these. Or do you want unlabelled ones? In that case use nauty, Import["! geng -c 9", "Graph6"], or with IGraph/M (faster and more supported import formats) IGImport["! geng -c 9", "Nauty"]. Search for my answers that utilize nauty / geng on this site. $\endgroup$ Commented Jun 6 at 8:24
  • $\begingroup$ You can get all trees on $n$ unlabeled nodes by Graph[GraphData[#, "Graph"], VertexLabels -> "Name"] & /@ GraphData["Tree", n]. (There are 47 trees on 9 nodes.) Then you can add as many edges as you want. $\endgroup$ Commented Jun 6 at 8:32
  • $\begingroup$ @A.Kato It's not possible to generate all graphs this way. If you want labelled graphs, starting with unlabelled trees is not going to work. If you want unlabelled graphs, adding edges to trees will create isomorphic duplicates. There is no need to try to come up with such hacks when there are excellent tools that get the job done (nauty). $\endgroup$ Commented Jun 6 at 8:52
  • $\begingroup$ @Szabolcs I don't think I necessarily need labelled graphs. I will try looking through your previous answers and working with nauty, and then I will see how that works out for me. Thank you! $\endgroup$ Commented Jun 6 at 20:14