The current graph.rs doesn't deduplicate edges. If file A imports module B twice (e.g., in different scopes), two identical edges are created. This inflates degree counts and affects god node analysis.
What needs to change:
- In KnowledgeGraph::from_extractions() in src/graph.rs, track existing edges using a HashSet<(String, String, EdgeKind)>
- Before adding an edge, check if a (source_id, target_id, kind) triple already exists
- If the edge exists, optionally increment its weight instead of adding a duplicate
- Add a unit test that verifies duplicate edges are merged
The current graph.rs doesn't deduplicate edges. If file A imports module B twice (e.g., in different scopes), two identical edges are created. This inflates degree counts and affects god node analysis.
What needs to change: