def exclude_subtree_from(self, package):
sub = dfs_tree(self.G, package)
root = nx.topological_sort(self.G)[0]
seen = {package}
for n in sub.nodes():
if n in seen:
continue
seen.add(n)
if local_node_connectivity(self.G, root, n) > 1:
sub.remove_nodes_from(InstalledGraph(sub).exclude_subtree_from(n))
return InstalledGraph(sub)
评论列表
文章目录