def aut_problem(graphlist):
    graphs = loadgraph("../graphs/" + graphlist + ".grl", graphclass=graph, readlist=True)[0]
    print("Sets of isomorphic graphs:                   Number of automorphisms:")
    isomorphisms = []
    for i in range(len(graphs)):
        for j in range(i, len(graphs)):

            G = graphs[i]
            H = graphs[j]
            GH = disjointunion(G, H)
            numIso = countIsomorphism(GH, G, H, [], [], 1, True)
            if numIso > 0:
                found = False
                for isos in isomorphisms:
                    if isos[0] == i:
                        isos.append(j)
                        found = True
                    for dingen in isos:
                        if i == dingen:
                            found = True
                if not found:
                    isomorphisms.append([i])
    listoflist = []
    for k in isomorphisms:
        i = k[0]
        G = graphs[i]
        H = graphs[i]
        GH = disjointunion(G, H)
        numIso = countIsomorphism(GH, G, H, [], [], 1, False)
        if numIso > 0:
            # print(str(k) + ": " + str(numIso))
            listoflist.append([str(k), str(numIso)])
    for row in listoflist:
        print("%-40s %6s" % (row[0], row[1]))
def gi_problem(graphlist):
    graphs = loadgraph("../graphs/" + graphlist + ".grl", graphclass=graph, readlist=True)[0]
    print("Sets of isomorphic graphs:")
    isomorphisms = []

    for i in range(len(graphs)):
        for j in range(i, len(graphs)):

            G = graphs[i]
            H = graphs[j]
            GH = disjointunion(G, H)
            numIso = countIsomorphism(GH, G, H, [], [], 1, True)
            if numIso > 0:
                found = False
                for isos in isomorphisms:
                    if isos[0] == i:
                        isos.append(j)
                        found = True
                    for dingen in isos:
                        if i == dingen:
                            found = True
                if not found:
                    isomorphisms.append([i])
    for row in isomorphisms:
        print(str(row))
Example #3
0
def aut_single_graph(graphfile):
    G = loadgraph("graphs/" + graphfile + ".gr", graphclass=graph)
    H = loadgraph("graphs/" + graphfile + ".gr", graphclass=graph)
    GH = disjointunion(G, H)
    numIso = countIsomorphism(GH, G, H, [], [], 1, False)
    if numIso > 0:
        print("Number of automorphisms: " + str(numIso))
def countAutomorphisms(findSingleIso=False, writeDot=False):
    L = loadgraph("../graphs/cographs1.grl", graphclass=graph, readlist=True)
    G = L[0][0]
    H = L[0][3]

    GH = disjointunion(G, H)
    t1 = timeMs()
    numberofIso = countIsomorphism(GH, G, H, D, I, 1, findSingleIso)
    print("Number of Isomorphisms: " + str(numberofIso))
    timing = (timeMs() - t1)
    # print("Time runned: " + str(timing) + "ms")
    if writeDot:
        writeDOT(GH, "examplegraph.dot")
    return timing
def branching_rules(findSingleIso=False, writeDot=False):
    # L = loadgraph("../graphs/colorref_smallexample_4_7.grl", graphclass=graph, readlist=True)
    branching_rules = {0, 1, 2, 3}
    for rule in branching_rules:

        L = loadgraph("../graphs/products72.grl", graphclass=graph, readlist=True)
        G = L[0][4]
        H = L[0][7]
        GH = disjointunion(G, H)

        t1 = timeMs()

        numberofIso = countIsomorphism(GH, G, H, [], [], rule, findSingleIso)
        print("Number of Isomorphisms: " + str(numberofIso))
        print("Time runned: " + str((timeMs() - t1)) + "ms for branching rule: " + str(rule))
        if writeDot:
            writeDOT(GH, "examplegraph.dot")