def refineFurther(groups, aut): newGroups = [] automorphisms = dict() graphs = len([g for group in groups for g in group ]) counter = 1 for group in groups: for g in group: print() print("Checking graph %i (%i/%i)"%(counter - 1, counter, graphs)) counter += 1 placed = False for newGroup in newGroups: if newGroup[0] in group: out = areIsomorph(g, newGroup[0], False) if out: newGroup.append(g) placed = True break if not placed: newGroups.append([g]) print("New group made...") if aut: print("Counting automorphisms...") if isTree(g): print("Tree detected: using optimalized algorithm...") automorphisms[g] = countTreeAutomorphismsRS(g) else: automorphisms[g] = areIsomorph(g, disjointUnionMulti([g], True), True) return newGroups, automorphisms
def graphInfo(self, filename): if filename[-2:] == "gr": gl = [loadgraph(filename, readlist=False)] else: gl = loadgraph(filename, readlist=True)[0] print("This file contains %i graph%s"%(len(gl), "s" if len(gl) > 1 else "")) i = 0 for g in gl: print("Graph %i:"%i) print("\tIs %sconnected, is %sa tree, has %i vertice%s and %i edge%s" %("" if isConnected(g) else "not ", "" if isTree(g) else "not ", len(g.V()), "s" if len(g.V()) > 1 else "", len(g.E()), "s" if len(g.E()) > 1 else "")) i+=1