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

Method GetbackSubgraph

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

Source from the content-addressed store, hash-verified

487 return update_node_list
488
489 def GetbackSubgraph(self, node, depth,sense):
490 subgraph = set()
491 if depth == 0:
492 return subgraph
493
494 score = {}
495 attr_list = {}
496 for i in self.G.predecessors(node):
497 score[i] = (self.GetNodeScore(i), self.G.out_degree(i)/ (self.G.in_degree(i) + 1))
498
499 new_score = sorted(score.items(), key=lambda d: (d[1][0],d[1][1]), reverse=True)[:10]
500 node_list = [i[0] for i in new_score]
501 for i in node_list:
502 if i in sense:
503 continue
504 sense.add(i)
505 subgraph.add(i)
506 x = self.GetbackSubgraph(i,depth - 1,sense)
507 subgraph |= x
508
509 return subgraph
510
511 def GetforeSubgraph(self, node, depth,sense):
512 subgraph = set()

Callers 1

propagationMethod · 0.95

Calls 1

GetNodeScoreMethod · 0.95

Tested by

no test coverage detected