Exemplo n.º 1
0
def test_permutations(filename):
    adj = ca.process_graph_file(filename)
    adj_perms = graph_manip.all_permutations(adj)
    print(filename, len(adj_perms))
    if len(adj_perms) > 10000:
        print("more than 10K perms! Just test basic", len(adj_perms), filename)
        g = graph_manip.create_networkx_graph(filename)
        if not compare_maximal(g):
            print(filename, " failed")
            return False
        return True
    for p in adj_perms:
        this_g = graph_manip.convert_to_nx(p)
        nwx_results = [
            set(x) for x in list(nx.algorithms.clique.find_cliques(this_g))
        ]

        this_res = ca.processing_steps(p)
        our_results = [set(x) for x in cg.core_results_to_cliques(this_res)]
        our_results = rem_subsets(our_results)
        if not same_results(nwx_results, our_results):
            print("adj failed", p)
            print(graph_manip.pretty_print(p))
            return False
    return True
def test_permutations(filename):
    adj = ca.process_graph_file(filename)
    adj_perms = graph_manip.all_permutations(adj)
    print(filename, len(adj_perms))
    if len(adj_perms) > 10000:
        print("more than 10K perms! Just test basic", len(adj_perms), filename)
        g = graph_manip.create_networkx_graph(filename)
        if not compare_maximal(g):
            print(filename, " failed")
            return False
        return True
    for p in adj_perms:
        this_g = graph_manip.convert_to_nx(p)
        nwx_results = [set(x) for x in list(nx.algorithms.clique.find_cliques(this_g))]

        this_res = ca.processing_steps(p)
        our_results = [set(x) for x in cg.core_results_to_cliques(this_res)]
        our_results = rem_subsets(our_results)
        if not same_results(nwx_results, our_results):
            print("adj failed", p)
            print(graph_manip.pretty_print(p))
            return False
    return True
def process_from_file(graph_file):
    adj_matrix = process_graph_file(graph_file)
    logging.info(graph_manip.pretty_print(adj_matrix))
    return processing_steps(adj_matrix)