It is well discussed in many graph theory texts that it is somewhat hard to distinguish non-isomorphic graphs with large order. But as to the construction of all the non-isomorphic graphs of any given order not as much is said. So, it follows logically to look for an algorithm or method that finds all these graphs.

A Google search shows that a paper by P. O. de Wet gives a simple construction that yields approximately $\sqrt{T_n}$ non-isomorphic graphs of order n.

( $\{T_n}$ being the number of labeled graphs of order n.)

So, I have the followings to ponder over:

(1) Are there such algorithms or has there been an improvement on the aforementioned algorithm?

(2) Where can I find a collection of non-isomorphic graphs of a given order?

If you allow me, I would also like to extend my question to connected graphs.

Many thanks.

(I am a beginner in Graph theory, so please give answers in not-very-specialized terms.)

  • 5
    $\begingroup$ This is sequence 88 in Sloane's OEIS, which lists many references. oeis.org/A000088 $\endgroup$ Jun 28, 2010 at 15:58
  • $\begingroup$ Timothy, much obliged! For me this is more than a comment. $\endgroup$
    – Unknown
    Jun 28, 2010 at 16:46

4 Answers 4


The nauty software contains the "geng" program, which enumerates all nonisomorphic graphs of a given order, or only connected ones, or selected on a wide range of other criteria. The method is tuned for practical speed rather than simplicity or theoretical bounds. The author Brendan McKay also has a page where you can download nonisomorphic (connected) graphs up to 10 vertices.

  • $\begingroup$ Nice answer. But I can't open them. I tried a lot on Windows XP. $\endgroup$
    – Unknown
    Jun 26, 2010 at 15:47
  • $\begingroup$ Support for gtools is limited to Unix. How sad for me. $\endgroup$
    – Unknown
    Jun 26, 2010 at 17:27
  • $\begingroup$ I have got them to work using cygwin on windows $\endgroup$ Sep 26, 2010 at 20:11
  • $\begingroup$ You can use nauty inside of Sage. $\endgroup$
    – GeoffDS
    Dec 8, 2012 at 16:51

Acknowledging Timothy’s comment, let me answer the question.

For a diagrammatic list of the non-isomorphic graphs (all in pdfs):

  1. http://keithbriggs.info/images/g4.pdf

  2. http://keithbriggs.info/images/g5.pdf

  3. http://keithbriggs.info/images/g6.pdf

  4. http://keithbriggs.info/images/g7.pdf

  5. http://keithbriggs.info/images/n8m9.pdf

  6. http://keithbriggs.info/images/g10-8.pdf

  7. Small graphs

I quote “The topologies were computed using the nauty program by Brendan McKay and the layouts created with graphviz. I wrote python programs to interface these and produce the pdfs.”


Sage also has graph theory tools here. For example:

for g in graphs(4):
    print g.spectrum()
  • $\begingroup$ This is it though it took me some time. $\endgroup$
    – Unknown
    Jun 28, 2010 at 8:18
  • $\begingroup$ Sage has nauty built in. It's much faster to do: for g in graphs.nauty_geng("4"): print g.spectrum() Or, if you only care about connected, "4 -c". $\endgroup$
    – GeoffDS
    Jul 25, 2012 at 14:25


Combinatorial algorithms: an update, Herbert S. Wilf, Albert Nijenhuis SIAM, 1989. Chapter 8: Generating Random Graphs.

The chapter gives an algorithm for producing an undirected graph uniformly over all graphs of size $n$. It is based on Polya counting. Computing the enumerating polynomial depends on some group theory that is time consuming (I don't know the complexity class, but I'll just conjecture it is most likely exponential space on $n$). But it is a guarantee of uniform distribution. Unfortunately I don't know of a way (I haven't heard of a way) to derandomize this to create an unranking algorithm (to give a mapping from the naturals to the set of unlabeled graphs).

The algorithm presented in your link (by de Wet) is cute (I mean that in the sense that it is cleverly simple, does not lie, but doesn't really give the meat of it, what it means to have a list of non-isomorphic graphs). The graphs created there have a very particular structure (two paths with an arbitrary subset of edges between the paths, plus some small widgets on one end of each path to break symmetry. All subsets is a good trick but having two paths is pretty uncommon and $\sqrt{T_n}\over T_n$ goes to 0 as $n$ grows.

As to practicality, in addition to the suggestions of nauty and Sage, there's also Mathematica (commercial) which has a list (that you can manipulate) of graphs up to size 11.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.