averageUnion += timeList[key][0] averageIso += timeList[key][2] print("**************************") print(key + ":") print("Disjoint union: " + str(timeList[key][0])) print("Is isomorphism: " + str(timeList[key][1])) print("Time isomorphism: " + str(timeList[key][2])) averageIso = averageIso / no averageUnion = averageUnion / no print("\n") print("Average time for disjoint union: " + str(averageUnion)) print("Average time for is isommorphism: " + str(averageIso)) print("Total average time: " + str(averageIso + averageUnion)) # ----- MAIN ----- GL, settings = loadgraph("graphs\\tree150.grl", FastGraph, True) timeList = dict() x = 0 y = 0 for j in range(len(GL)): x += len(GL[j].E()) y += 1 print(x / y) for j in range(len(GL)): if j != 0: timeEntry = [] G = GL[x] H = GL[j] key = str(x) + " and " + str(j) start = time() union = disjoint_union(G, H)
from final.graphutil import disjoint_union from final.countisomorphism import count_isomorphism from final.graphIO import loadgraph from final.fastgraphs import FastGraph def count_automorphism(g): h = disjoint_union(g, g) return count_isomorphism(h) # ----- MAIN ----- GL, settings = loadgraph("graphs\\torus24.grl", FastGraph, True) G = GL[0] print(count_automorphism(G))