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.
11 if len(sys
.argv
) != 2:
12 print 'Usage: depfilter.py NODE'
19 lines
= sys
.stdin
.readlines()
23 for arc
in lines
[1:-1]:
24 match
= sre
.search('"(.*)" -> "(.*)"', arc
)
25 n1
, n2
= match
.group(1), match
.group(2)
26 if not graph
.has_key(n1
):
30 # Create subset of 'graph' rooted at 'top'
35 if graph
.has_key(node
) and not subgraph
.has_key(node
):
36 subgraph
[node
] = graph
[node
]
46 for key
, value
in subgraph
.items():
48 print '\t"%s" -> "%s"' % (key
, n
)