def print_impacted_modules(single_node=None):
"""
For each module, print a list of modules that depend on the module, i.e.
modules that would be impacted by a change in this module. The function
shows all levels of dependency, not just the immediately impacted
modules.
:return:
"""
print('\n===Impacted Modules===')
for node_name in G.nodes_iter():
if single_node and (node_name!=single_node):
continue
ancestors = nx.ancestors(G, node_name)
if len(ancestors) > 0:
print(augment_format_string(node_name, '\n%s:') % node_name)
for a in ancestors:
print(augment_format_string(a, ' %s') % a)
评论列表
文章目录