DhanushNehru / DhanushNehru/codeskeleton

Handle duplicate edges in graph construction

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.