Load the edges map from the dump file, and filter it to only show targets in |targets| and their depedendents.
(filename, targets)
| 20 | |
| 21 | |
| 22 | def LoadEdges(filename, targets): |
| 23 | """Load the edges map from the dump file, and filter it to only |
| 24 | show targets in |targets| and their depedendents.""" |
| 25 | |
| 26 | file = open("dump.json") |
| 27 | edges = json.load(file) |
| 28 | file.close() |
| 29 | |
| 30 | # Copy out only the edges we're interested in from the full edge list. |
| 31 | target_edges = {} |
| 32 | to_visit = targets[:] |
| 33 | while to_visit: |
| 34 | src = to_visit.pop() |
| 35 | if src in target_edges: |
| 36 | continue |
| 37 | target_edges[src] = edges[src] |
| 38 | to_visit.extend(edges[src]) |
| 39 | |
| 40 | return target_edges |
| 41 | |
| 42 | |
| 43 | def WriteGraph(edges): |