MCPcopy Create free account
hub / github.com/PKU-ASAL/Simulated-Data / GetforeSubgraph

Method GetforeSubgraph

src/ETW/real-time/ProvGraph.py:511–532  ·  view source on GitHub ↗
(self, node, depth,sense)

Source from the content-addressed store, hash-verified

509 return subgraph
510
511 def GetforeSubgraph(self, node, depth,sense):
512 subgraph = set()
513 if depth == 0:
514 return subgraph
515
516 score = {}
517 attr_list = {}
518 for i in self.G.successors(node):
519 score[i] = (self.GetNodeScore(i),self.G.out_degree(i)/ (self.G.in_degree(i) + 1))
520
521 new_score = sorted(score.items(), key=lambda d:(d[1][0],d[1][1]), reverse=True)[:10]
522 node_list = [i[0] for i in new_score]
523
524 for i in node_list:
525 if i in sense:
526 continue
527 sense.add(i)
528 subgraph.add(i)
529 x = self.GetforeSubgraph(i,depth - 1,sense)
530 subgraph |= x
531
532 return subgraph
533
534 def propagation(self,update_node_list, f_depth = 5, b_depth = 5, alg = 'sum'):
535 if alg == 'sum':

Callers 1

propagationMethod · 0.95

Calls 1

GetNodeScoreMethod · 0.95

Tested by

no test coverage detected