nodes[u] = set() if v not in nodes: nodes[v] = set() nodes[u].add(v) nodes[v].add(u) assert( (old_t == None) or (t >= old_t) ) old_t = t nb_lines = nb_lines + 1 #Debug: print all links in dataset # for link in times: # for time in times[link]: # for v in link: # sys.stdout.write("%s "%v) # print(time[0], time[1]) Cm._times = times Cm._nodes = nodes sys.stderr.write("Processed " + str(nb_lines) + " from stdin\n") ## Start execution R = Cm.getMaximalCliques(omega+delta/2) Cm.printCliques()
v = contents[2].strip() link = frozenset([u, v]) time = (t, t) # This a new instance Cm.addClique(Clique((link, time), set([]))) # Populate data structures if link not in times: times[link] = [] times[link].append(t) if u not in nodes: nodes[u] = set() if v not in nodes: nodes[v] = set() nodes[u].add(v) nodes[v].add(u) nb_lines = nb_lines + 1 Cm._times = times Cm._nodes = nodes sys.stderr.write("Processed " + str(nb_lines) + " from stdin\n") # Restart execution R = Cm.getDeltaCliques(delta) sys.stdout.write("# delta = %d\n" % (delta)) Cm.printCliques()
def run(self): #graphTypes = ["Link stream", "Multiplex graph", "Simple graph"] self.delta = self.dataSet["Delta"] self.graph_type = self.dataSet["Input graph type"].getCurrentString() self.node_prop = self.dataSet["Node class - link stream"] self.one_boolean_property_per_clique = self.dataSet["Boolean property output"] #graphType = "Link stream" #if graph.getName() in graphTypes: # graphType = graph.getName() #node_prop = graph.getStringProperty("__original_node__") if self.graph_type == "Link stream" or self.graph_type == "Multiplex graph": self.time_stamp = self.dataSet["Time double property - Link stream / Multiplex graph"] #timeStamp = graph.getDoubleProperty("__timeStamp__") elif self.graph_type == "Simple graph": self.time_stamp = self.dataSet["Time vector property - Simple graph"] #timeStamp = graph.getDoubleVectorProperty("__timeStampList__") # Initiate Cm = CliqueMaster() times = dict() nodes = dict() nb_lines = 0 # Read stream # maybe just rewrite an individual accessor for 1 triplet # instead of the whole conversion # (needs the edge object for effective return) for contents in self.tripletGen(): #print contents t = contents[0] u = contents[1] v = contents[2] link = frozenset([u, v]) time = (t, t) Cm.addClique(Clique((link, time), set([]))) # Populate data structures if link not in times: times[link] = [] times[link].append(t) if u not in nodes: nodes[u] = set() if v not in nodes: nodes[v] = set() nodes[u].add(v) nodes[v].add(u) nb_lines = nb_lines + 1 Cm._times = times Cm._nodes = nodes tmp_std_err = sys.stderr sys.stderr = NullDevice() results = Cm.getDeltaCliques(self.delta) sys.stderr = tmp_std_err self.mapCliquesBack(results) return True