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

Method GetbackSubgraph

src/Sysdig/real-time/ProvGraph.py:499–519  ·  view source on GitHub ↗
(self, node, depth,sense)

Source from the content-addressed store, hash-verified

497 return update_node_list
498
499 def GetbackSubgraph(self, node, depth,sense):
500 subgraph = set()
501 if depth == 0:
502 return subgraph
503
504 score = {}
505 attr_list = {}
506 for i in self.G.predecessors(node):
507 score[i] = (self.GetNodeScore(i),self.G.out_degree(i)/ (self.G.in_degree(i) + 1))
508
509 new_score = sorted(score.items(), key=lambda d: (d[1][0],d[1][1]), reverse=True)[:10]
510 node_list = [i[0] for i in new_score]
511 for i in node_list:
512 if i in sense:
513 continue
514 sense.add(i)
515 subgraph.add(i)
516 x = self.GetbackSubgraph(i,depth - 1,sense)
517 subgraph |= x
518
519 return subgraph
520
521 def GetforeSubgraph(self, node, depth,sense):
522 subgraph = set()

Callers 1

propagationMethod · 0.95

Calls 1

GetNodeScoreMethod · 0.95

Tested by

no test coverage detected