def get_communities(self, node_ids, walk_length=10, walk_trials=1000, member_portion=200): return cwg.communities(self.graph, node_ids, walk_length, walk_trials, member_portion)
import community_walk_graph as cwg graph = cwg.new_graph() cwg.add_edge(graph, 1, 2) cwg.add_edge(graph, 2, 3) cwg.add_edge(graph, 3, 4) cwg.add_edge(graph, 4, 5) cwg.add_edge(graph, 5, 6) cwg.add_edge(graph, 6, 7) cwg.add_edge(graph, 7, 8) cwg.add_edge(graph, 8, 9) cwg.add_edge(graph, 9, 10) cwg.add_edge(graph, 10, 11) cwg.add_edge(graph, 11, 12) cwg.add_edge(graph, 12, 13) cwg.add_edge(graph, 13, 14) cwg.add_edge(graph, 14, 15) cwg.add_edge(graph, 15, 16) cwg.add_edge(graph, 16, 17) cwg.add_edge(graph, 17, 18) cwg.add_edge(graph, 18, 19) cwg.add_edge(graph, 19, 20) cwg.add_edge(graph, 20, 1) communities_result = cwg.communities(graph, [1, 2, 3, 4, 5, 11, 12, 13, 14, 15], 7, 100, 50) print(communities_result)