Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

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.)

share|improve this question
This is sequence 88 in Sloane's OEIS, which lists many references. oeis.org/A000088 –  Timothy Chow Jun 28 '10 at 15:58
Timothy, much obliged! For me this is more than a comment. –  Unknown Jun 28 '10 at 16:46
add comment

4 Answers

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.

share|improve this answer
Nice answer. But I can't open them. I tried a lot on Windows XP. –  Unknown Jun 26 '10 at 15:47
Support for gtools is limited to Unix. How sad for me. –  Unknown Jun 26 '10 at 17:27
I have got them to work using cygwin on windows –  Dave Pritchard Sep 26 '10 at 20:11
You can use nauty inside of Sage. –  Graphth Dec 8 '12 at 16:51
add comment


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.

share|improve this answer
add comment

Sage also has graph theory tools here. For example:

for g in graphs(4):
    print g.spectrum()
share|improve this answer
This is it though it took me some time. –  Unknown Jun 28 '10 at 8:18
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". –  Graphth Jul 25 '12 at 14:25
add comment
up vote 1 down vote accepted

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.”

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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