Build reverse call graph: function -> list of functions that call it
(call_graph: dict[str, list[str]])
| 501 | |
| 502 | |
| 503 | def build_reverse_call_graph(call_graph: dict[str, list[str]]) -> dict[str, list[str]]: |
| 504 | """Build reverse call graph: function -> list of functions that call it""" |
| 505 | reverse_graph: defaultdict[str, list[str]] = defaultdict(list) |
| 506 | |
| 507 | for caller, callees in call_graph.items(): |
| 508 | for callee in callees: |
| 509 | reverse_graph[callee].append(caller) |
| 510 | |
| 511 | return dict(reverse_graph) |
| 512 | |
| 513 | |
| 514 | def analyze_map_file(map_file: Path) -> dict[str, list[str]]: |