Counting graphs We want to count the number of different graphs on n vertices up to symmetry. Two graphs are considered the same if there is a bijection between the vertices of the graphs which preserves the edges. If we consider the vertices to be the numbers 1 to n and the possible edges the pairs {a, b} of vertices, all graphs, including duplicates (this set is called the set of labelled graphs as we are considering graphs different if the vertices are labelled with different numbers) are described by the possible subsets of edges (thus there n are 2( 2 ) of them). Symmetries are obtained by the action of the symmetric group Sn on the vertices, each orbit corresponding to one type of graphs. We are using the Cauch-Frobenius-Burnside lemma to count the number of orbits. For this we need to know the number of labelled graphs fixed by a permutation π: If {a, b} is an edge, also {aπ , bπ } must be an edge. Thus to describe graphs fixed by π we can choose edge/nonedge only on orbits of π on pairs. I.e. the number of labelled graphs fixed by π equals 2k where k is the number of orbits of π on the n2 pairs of points. Furthermore conjugate permutations will have the same number of fixed points, thus we need to compute fixed points only for conjugacy class representatives (and then multiply with the size of the class). Note that the classes of Sn are described by partitions of n and that we can describe the number of elements in a class by easy counting (proposition 13.1.5 in the book), thus – short of being tedious – we could do this calculation by hand. We start with the graphs on 6 vertices. We construct the symmetric group and the set of possible edges. gap> g:=SymmetricGroup(6); Sym( [ 1 .. 6 ] ) gap> edges:=Combinations([1..6],2); [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 1, 5 ], [ 1, 6 ], [ 2, 3 ], [ 2, 4 ], [ 2, 5 ], [ 2, 6 ], [ 3, 4 ], [ 3, 5 ], [ 3, 6 ], [ 4, 5 ], [ 4, 6 ], [ 5, 6 ] ] gap> Length(edges); 15 Next obtain representatives of the conjugacy classes: gap> cl:=ConjugacyClasses(g);;Length(cl); 11 gap> reps:=List(cl,Representative); [ (), (1,2), (1,2)(3,4), (1,2)(3,4)(5,6), (1,2,3), (1,2,3)(4,5), (1,2,3)(4,5,6), (1,2,3,4), (1,2,3,4)(5,6), (1,2,3,4,5), (1,2,3,4,5,6) ] For each class representative i we calculate the number of orbits on the edges and thus the number of fixed graphs. gap> List(reps,i->Length(Orbits(Group(i),edges,OnSets))); [ 15, 11, 9, 9, 7, 5, 5, 5, 5, 3, 3 ] gap> fix:=List(reps,i->2^Length(Orbits(Group(i),edges,OnSets))); [ 32768, 2048, 512, 512, 128, 32, 32, 32, 32, 8, 8 ] Finally we calculate from this the average number of fixed points, which equals the number of orbits gap> Sum(List([1..11],i->Size(cl[i])*fix[i]))/Size(g); 156 We thus found that there are 156 different (up to symmetry) graphs on 6 vertices, however we do not have an obvious way of enumerating them without needing to do symmetry tests. The same approach works for larger degrees – the only bottleneck is eventually the arithmetic with very large integers: gap> g:=SymmetricGroup(10); Sym( [ 1 .. 10 ] ) gap> cl:=ConjugacyClasses(g);; Length(cl); 42 gap> edges:=Combinations([1..10],2); [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 1, 5 ], [ 1, 6 ], [ 1, 7 ], [ 1, 8 ], [ 1, 9 ], [ 1, 10 ], [ 2, 3 ], [ 2, 4 ], [ 2, 5 ], [ 2, 6 ], [ 2, 7 ], [ 2, 8 ], [ 2, 9 ], [ 2, 10 ], [ 3, 4 ], [ 3, 5 ], [ 3, 6 ], [ 3, 7 ], [ 3, 8 ], [ 3, 9 ], [ 3, 10 ], [ 4, 5 ], [ 4, 6 ], [ 4, 7 ], [ 4, 8 ], [ 4, 9 ], [ 4, 10 ], [ 5, 6 ], [ 5, 7 ], [ 5, 8 ], [ 5, 9 ], [ 5, 10 ], [ 6, 7 ], [ 6, 8 ], [ 6, 9 ], [ 6, 10 ], [ 7, 8 ], [ 7, 9 ], [ 7, 10 ], [ 8, 9 ], [ 8, 10 ], [ 9, 10 ] ] gap> reps:=List(cl,Representative);; gap> fix:=List(reps,i->2^Length(Orbits(Group(i),edges,OnSets))); [ 35184372088832, 137438953472, 2147483648, 134217728, 33554432, 33554432, 536870912, 8388608, 524288, 131072, 524288, 32768, 8192, 32768, 8388608, 524288, 131072, 131072, 8192, 2048, 512, 8192, 8192, 131072, 8192, 2048, 512, 128, 128, 512, 8192, 2048, 2048, 512, 128, 512, 128, 32, 128, 128, 32, 32 ] gap> Sum(List([1..42],i->Size(cl[i])*fix[i]))/Size(g); 12005168