3 # Filter out arcs in a dotty graph that are at or below a certain
4 # node. This is useful for visualising parts of the dependency graph.
9 from __future__ import print_function
13 if len(sys.argv) != 2:
14 print('Usage: depfilter.py NODE')
21 lines = sys.stdin.readlines()
25 for arc in lines[1:-1]:
26 match = re.search('"(.*)" -> "(.*)"', arc)
27 n1, n2 = match.group(1), match.group(2)
32 # Create subset of 'graph' rooted at 'top'
38 if node in graph and node not in subgraph:
39 subgraph[node] = graph[node]
48 print(lines[0], end=' ')
50 for key, value in subgraph.items():
52 print('\t"%s" -> "%s"' % (key, n))
54 print(lines[-1], end=' ')