def EdgeTransitive(path,n): # Writes all (not necessarily connected) edge transitive graphs of order n to path/AllETgraphs/ETn.g6 # Requires: - list of all connected ET graphs of order k <= n, at path/ConnectedETGraphs/ETkc.g6 # - list of all (not necessarily connected) ET graphs of order n-1, at path/ConnectedETGraphs/ET(n-1)c.g6 # All files in graph6 format # Uses the fact that the (not necessarily connected) edge transitive graphs of order n can be partitioned into three sets: # - Connected # - Disconnected and contain an isolated vertex # - Disconnected, no isolated vertex - in this case, all components are isomorphic and edge transitive o = open(path+"/AllETGraphs/ET"+str(n)+".g6","w") f=open(path+"/ConnectedETGraphs/ET"+str(n)+"c.g6","r") g=open(path+"/AllETGraphs/ET"+str(n-1)+".g6","r") d = {"h"+str(k) : open(path+"/ConnectedETGraphs/ET"+str(k)+"c.g6","r") for k in range(1,n)} for line in f.xreadlines(): # First add all connected edge transitive graphs o.write(line) f.close() for line in g.xreadlines(): # Next add all disconnected edge transitive graphs that contain an isolated vertex. # Obtained by adding an isolated vertex to every (not necessarily connected) # edge transitive graph of order n-1 G=Graph(line) G.add_vertex(n-1) o.write(G.graph6_string()+"\n") # Finally, add all disconnected edge transitive graphs that do not contain an isolated vertex. # All components will be isomorphic and edge transitive. for k in range(2,n/2+1): # Run through possible orders k for the components if n%k==0: # k must divide n for line in d["h"+str(k)]: G=Graph(line) # G is a connected edge transitive graph of order k H=G.copy() for i in range(1,n/k): H=H.disjoint_union(G) # H is now the disjoint union of n/k copies of G o.write(H.graph6_string()+"\n") f.close() g.close() for k in range(1,n): d["h"+str(k)].close() o.close() def CountLines(path,n): #Counts number of lines in path/AllETGraphs/ETn.g6 f=open(path+"/AllETGraphs/ET"+str(n)+".g6") i=0 for line in f.xreadlines(): i+=1 return i # Input path here p="/Users/lgmol/Desktop/EdgeTransitiveGraphs" for n in range(2,48): EdgeTransitive(p,n) for n in range(1,48): print n, CountLines(p,n) # Output of final loop: # 1 1 # 2 2 # 3 4 # 4 8 # 5 12 # 6 21 # 7 26 # 8 38 # 9 49 # 10 67 # 11 74 # 12 105 # 13 115 # 14 137 # 15 168 # 16 206 # 17 218 # 18 264 # 19 276 # 20 340 # 21 384 # 22 416 # 23 429 # 24 533 # 25 571 # 26 613 # 27 675 # 28 764 # 29 782 # 30 926 # 31 945 # 32 1066 # 33 1119 # 34 1166 # 35 1242 # 36 1464 # 37 1488 # 38 1537 # 39 1609 # 40 1856 # 41 1882 # 42 2096 # 43 2121 # 44 2244 # 45 2445 # 46 2505 # 47 2530