DhanushNehru / DhanushNehru/codeskeleton
Handle duplicate edges in graph construction
Open
documentation
enhancement
help wanted
- Dominant language
- Rust
- Stars
- 15
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
Assessment
This issue has not been assessed yet.