예제 #1
0
def main(args):
    psyco.full()
    list_nodes = [str(n) for n in xrange(1, 201)]
    #    test_list = [random.sample(list_nodes, 200) for i in xrange(100)]
    edges = get_edges_from_file("./benchmarks/brock200_3.clq")
    #    edges = get_edges_from_file("./benchmarks/In200_40_13_0.txt")
    #    edges = get_edges_from_file("./benchmarks/MANN_a9.clq")
    start = time.time()
    graph = Graph(edges)
    print "graph: elapsed time - ", time.time() - start
    #    psyco.cannotcompile(graph.induced_subgraph_2)
    #    print "graph: elapsed time - ", time.time() - start
    start = time.time()
    copy = graph.dcopy()
    print "copy: elapsed time - ", time.time() - start
    start = time.time()
    for i in xrange(1, 201):
        subgraph = graph.induced_subgraph(str(i))
    print "subgraph: elapsed time - ", time.time() - start
    #    start = time.time()
    #    for i in xrange(1, 201):
    #        subgraph = graph.induced_subgraph_2(str(i))
    #    print "subgraph_c: elapsed time - ", time.time() - start
    start = time.time()
    graph.remove_nodes(list_nodes)
    print "remove: elapsed time - ", time.time() - start
예제 #2
0
def main(args):
    psyco.full()
    list_nodes = [str(n) for n in xrange(1,201)]
#    test_list = [random.sample(list_nodes, 200) for i in xrange(100)]
    edges = get_edges_from_file("./benchmarks/brock200_3.clq")
#    edges = get_edges_from_file("./benchmarks/In200_40_13_0.txt")
#    edges = get_edges_from_file("./benchmarks/MANN_a9.clq")
    start = time.time()
    graph = Graph(edges)
    print "graph: elapsed time - ", time.time() - start
#    psyco.cannotcompile(graph.induced_subgraph_2)
#    print "graph: elapsed time - ", time.time() - start
    start = time.time()
    copy = graph.dcopy()
    print "copy: elapsed time - ", time.time() - start
    start = time.time()
    for i in xrange(1, 201):
        subgraph = graph.induced_subgraph(str(i)) 
    print "subgraph: elapsed time - ", time.time() - start
#    start = time.time()
#    for i in xrange(1, 201):
#        subgraph = graph.induced_subgraph_2(str(i)) 
#    print "subgraph_c: elapsed time - ", time.time() - start
    start = time.time()
    graph.remove_nodes(list_nodes)
    print "remove: elapsed time - ", time.time() - start
예제 #3
0
파일: main.py 프로젝트: alsmadi/clik
def main(args):
    psyco.full()
    logging.basicConfig(filename='./results.log', level=logging.INFO, format="%(message)s")
    log = ['cardinality', 'linear coloring', 'dsatur']
    fun_1 = [UBA.upper_bound_from_cardinality_1, \
             UBA.upper_bound_from_linear_coloring_1]#, \
             #UBA.upper_bound_from_dsatur_1]
    fun_2 = [UBA.upper_bound_from_cardinality_2, \
             UBA.upper_bound_from_linear_coloring_2]#, \
             #UBA.upper_bound_from_dsatur_2]
    for dirpath, ignore, files in os.walk("./test/"):
        if dirpath == "./test/":
            for i in range(2):
                text = "---------- " + log[i]
                logging.info(text)
                print text
                files.sort()
                for nfile in files:
                    if nfile != ".directory":
                        filename = os.path.join(dirpath, nfile)
                        graph = Graph()
                        graph.add_edges(get_edges_from_file(filename))
                        upper_bound_fun_1 = fun_2[i]
                        sequential_elimination_algorithm_1(nfile, graph, upper_bound_fun_1)
                        #graph = Graph(get_edges_from_file(filename))
                        #upper_bound_fun_1 = fun_1[i]
                        #upper_bound_fun_2 = fun_2[i]
                        #sequential_elimination_algorithm_2(nfile, graph,
                                                             #upper_bound_fun_1,
                                                             #upper_bound_fun_2)
                        #graph = Graph()
                        #graph.add_edges(get_edges_from_file(filename))
                        #upper_bound_fun_1 = fun_1[i]
                        #upper_bound_fun_2 = fun_2[i]
                        #sequential_elimination_algorithm_2_p(nfile, graph,
                                                             #upper_bound_fun_1,
                                                             #upper_bound_fun_2)
    logging.info("********************************************")
    print "********************************************"