def time_compare(filename): g = graph_manip.create_networkx_graph(filename) with Timer() as t: nx.algorithms.clique.find_cliques(g) print("nx elapsed: %s", t.secs) with Timer() as t: ca.process_from_g(g) print("DESC elapsed: %s", t.secs)
def compare_maximal(g): """ Given the graph g, run the networkX version of finding all maximal cliques, and our version, and compare the sets. Fail if any are different. :param g: graph in networkx format :return: success flag """ nwx_results = nx_answer(g) print(len(nwx_results), " expected maximal cliques for ", str(g)) print("correct: ", nwx_results) our_results = [set(x) for x in cg.core_results_to_cliques( ca.process_from_g(g) )] our_results = rem_subsets(our_results) print("ours: ", our_results) if not same_results(nwx_results, our_results): return False return True
def compare_maximal(g): """ Given the graph g, run the networkX version of finding all maximal cliques, and our version, and compare the sets. Fail if any are different. :param g: graph in networkx format :return: success flag """ nwx_results = nx_answer(g) print(len(nwx_results), " expected maximal cliques for ", str(g)) print("correct: ", nwx_results) our_results = [ set(x) for x in cg.core_results_to_cliques(ca.process_from_g(g)) ] our_results = rem_subsets(our_results) print("ours: ", our_results) if not same_results(nwx_results, our_results): return False return True
def time_ours(filename): g = graph_manip.create_networkx_graph(filename) with Timer() as t: res = ca.process_from_g(g) print(res) print("DESC elapsed: ", t.secs)