def do_a_series_of_propagations(self): index = 0 while index < self.rounds and self.flag: index = index + 1 print("Label propagation round: " + str(index)) self.do_a_propagation() print("") print("Modularity is: "+ str(round(modularity(self.labels,self.graph),3)) + ".") json_dumper(self.labels, self.args.assignment_output)
def do_a_series_of_propagations(self): """ Doing propagations until convergence or reaching time budget. """ index = 0 while index < self.rounds and self.flag: index = index + 1 print("\nLabel propagation round: " + str(index)+".\n") self.do_a_propagation() print("") print("Modularity is: "+ str(round(modularity(self.labels,self.graph),3)) + ".\n") json_dumper(self.labels, self.args.assignment_output)
def do_a_series_of_propagations(self): """ Doing propagations until convergence or reaching time budget. """ index = 0 while index < self.rounds and self.flag: index = index + 1 print("\nLabel propagation round: " + str(index)+".\n") self.do_a_propagation() self.rounds=self.rounds-1 with open ('./data/lpani.txt','w') as f: for i in self.nodes: f.write(str(self.labels[i])+'\t') f.write(str(i)+'\t') f.write('\n') print("") for node in tqdm(self.nodes): print(self.labels[node]) print("Modularity is: " + str(round(modularity( self.labels,self.graph), 40)) + ".\n") json_dumper(self.labels, self.args.assignment_output)