(self,update_node_list, f_depth = 5, b_depth = 5, alg = 'sum')
| 564 | return subgraph |
| 565 | |
| 566 | def propagation(self,update_node_list, f_depth = 5, b_depth = 5, alg = 'sum'): |
| 567 | if alg == 'sum': |
| 568 | subgraph_node = set(update_node_list) |
| 569 | for node in update_node_list: |
| 570 | sense = {node} |
| 571 | local_subgraph = self.GetbackSubgraph(node,b_depth,sense) |
| 572 | subgraph_node |= local_subgraph |
| 573 | sense = {node} |
| 574 | local_subgraph = self.GetforeSubgraph(node,f_depth,sense) |
| 575 | subgraph_node |= local_subgraph |
| 576 | subgraph = self.G.subgraph(list(subgraph_node)).copy() |
| 577 | # subgraph = self.graph_taylor(subgraph) |
| 578 | # for node in subgraph.nodes(): |
| 579 | # if subgraph.in_degree(node) == 0 and self.GetNodeType(node) : |
| 580 | # remove_node.add(node) |
| 581 | connected_graph = [] |
| 582 | for n in nx.weakly_connected_components(subgraph): |
| 583 | g = subgraph.subgraph(n).copy() |
| 584 | # assert(nx.is_weakly_connected(g)) |
| 585 | g.graph['score'] = np.sum([self.GetNodeScore(i) for i in g.nodes()]) |
| 586 | connected_graph.append(g) |
| 587 | |
| 588 | return connected_graph |
| 589 | |
| 590 | def GetSubset(self,mmap,x,y): |
| 591 | mmap[x][y] = 0 |
no test coverage detected