Exemplo n.º 1
0
def main(strFileName, alpha = 5):
    print " *** Starting *** "
    G = gio.load_from_edge_list_named(strFileName)
   
    
    V, E, avgdeg = G.order(), G.size(), G.avg_degree()
    t1 = time.clock()
    Q, G, P, max_alpha = r3.incremental_depth_3COL(G, alpha)
    t2 = time.clock()
    strScreen = "3-COL: %d N: %d M: %d time1: %3.3f average degree: %2.2f alpha: %s" % (bool(Q), V, E, t2 - t1, avgdeg, max_alpha)
    print strScreen
    if not Q:
        witness = r3.UNCOL_witness(P)
    else:
        witness = r3.COL_witness(G, P)

    tu.save_witness("", Q, witness, "", strFileName)
Exemplo n.º 2
0
def main2(strFileName, alpha = 5):
    print " *** Starting *** "
    G = gio.load_from_edge_list_named(strFileName)

    V, E, avgdeg = G.order(), G.size(), G.avg_degree()
    t1 = time.clock()
    Q, G, P = r3.general_3COL(G, alpha)
    t2 = time.clock()
    strScreen = "3-COL: %d N: %d M: %d time1: %3.3f average degree: %2.2f alpha: %s" % (Q, V, E, t2 - t1, avgdeg, alpha)
    print strScreen
    if not Q:
        witness = r3.UNCOL_witness(P)
    elif Q == 1:
        witness = r3.COL_witness(G, P)
    else:
        return

    tu.save_witness("", Q, witness, "", strFileName)