relation ) EquivalenceClass.check_equivalence_partition(classes, partitions, relation) # for c in classes: print(c) # for o, c in partitions.items(): print(o, ':', c) return classes, partitions with open('seprox', 'r') as f: T = Ensemble() for line in f: line = line.strip() timestamp, v1, v2 = line.split('\t', 2) if v1 != v2: T.add_edge(timestamp, int(v1), int(v2)) else: T.add_node(int(v1)) nodes_freq_dist_map = collections.OrderedDict() ssd_buckets = collections.OrderedDict() with open('hyperedge-results/seprox/lam/top-1024-hyperedges.tsv', 'r') as f: for line in f: line = line.strip() nodes = [int(n) for n in line.split('\t')[:-1]] ssd = float(line.split('\t')[-1]) if ssd in ssd_buckets: ssd_buckets[ssd].append(nodes) else: ssd_buckets[ssd] = [nodes] dist = compute_subgraph_freq_distribution_for_nodes(T, nodes) if str(dist) in nodes_freq_dist_map: nodes_freq_dist_map[str(dist)].append(nodes)
import sys from Ensemble import Ensemble import matplotlib.pyplot as plt __author__ = 'adb' INPUTFILE = sys.argv[1] SIGMA = float(sys.argv[2]) CONSTRAINT = sys.argv[3] with open(INPUTFILE, 'r') as f: T = Ensemble() for line in f: line = line.strip() timestamp, v1, v2 = line.split('\t', 2) if v1 != v2: T.add_edge(timestamp, v1, v2) else: T.add_node(v1) # if CONSTRAINT == 'am': # T.generate_antimonotone_hyperedges_report(SIGMA) # elif CONSTRAINT == 'lam': # T.generate_looselyantimonotone_hyperedges_report(SIGMA) # else: # print(T.maximal_sigma_ssd_ucs(0.01)) d = T.compute_am_sigma_hyperedges_dict([0.01, 0.1, 0.2, 0.3]) for i in d: print(i, len(d[i]))
plot_ucs_size_composition_vs_ssd_cutoff(threeS, fourS, fiveS, ssd_range) return size_map_for_ssd_range with open(graph_summary_file, 'r') as f: for line in f: line = line.strip() summary = line.split('\t', 4) num_of_timestamps, num_of_nodes, min_num_of_edges, max_num_of_edges, total_num_of_edges = int( summary[0]), int(summary[1]), int(summary[2]), int( summary[3]), int(summary[4]) with open(datafile, 'r') as f: T = Ensemble() for line in f: line = line.strip() timestamp, v1, v2 = line.split('\t', 2) if v1 != v2: T.add_edge(timestamp, int(v1), int(v2)) else: T.add_node(int(v1)) plot_ssd_vs_rank(128) # plot_percent_of_nodes_vs_rank(1024, num_of_nodes) # plot_ssd_of_uncovered_nodes_vs_rank(2048, T) # print(plot_num_of_k_size_ucs_vs_ssd_cutoff_for_am([0.1, 0.2, 0.3, 0.4, 0.5, 0.6])) # print(plot_num_of_k_size_ucs_vs_ssd_cutoff_for_lam([0.1, 0.2, 0.3, 0.4, 0.5, 0.6])) plt.show()
import matplotlib.pyplot as plt __author__ = "adb" INPUTFILE = sys.argv[1] SIGMA = float(sys.argv[2]) CONSTRAINT = sys.argv[3] with open(INPUTFILE, "r") as f: T = Ensemble() for line in f: line = line.strip() timestamp, v1, v2 = line.split("\t", 2) if v1 != v2: T.add_edge(timestamp, v1, v2) else: T.add_node(v1) # if CONSTRAINT == 'am': # T.generate_antimonotone_hyperedges_report(SIGMA) # elif CONSTRAINT == 'lam': # T.generate_looselyantimonotone_hyperedges_report(SIGMA) # else: # print(T.maximal_sigma_ssd_ucs(0.01)) d = T.compute_am_sigma_hyperedges_dict([0.01, 0.1, 0.2, 0.3]) for i in d: print(i, len(d[i]))