You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build_from_json produces a simple networkx.Graph, so every additional edge between an already-connected pair is silently dropped. Step 4.5 measures the loss accurately — but only after Step 4 has already written graph.json:
Seven distinct call sites become one edge with one source_location. And relation_variant_groups: 57 means 57 pairs collapsed edges that did not even share a relation type — a calls and a references between the same two nodes keep only whichever landed first.
Why it matters beyond tidiness
Weight is lost. "Called from 7 places" and "called once" are the same edge afterwards, so anything ranking by coupling strength (god nodes, betweenness, suggest_questions) is computed on a flattened graph.
Provenance is lost.source_location for the surviving edge is arbitrary, so "where exactly does A use B" has one answer out of seven, with nothing marking it as partial.
The warning is unactionable as written. It says graph may be incomplete/corrupt after the fact; there is no flag to re-run without the loss, so the only response is to accept it.
Suggested fix, in order of cost
Aggregate rather than drop. On collision, keep one edge but set weight (or count) to the number of merged edges and carry source_locations as a list. No API change for consumers that ignore the extra fields, and the diagnostic drops to zero for the common case.
Do not merge across relation types — those 57 groups are a different fact being discarded, not a duplicate.
Environment
What happens
build_from_jsonproduces a simplenetworkx.Graph, so every additional edge between an already-connected pair is silently dropped. Step 4.5 measures the loss accurately — but only after Step 4 has already writtengraph.json:471 edges (~15% of valid candidates) are gone from the artifact, across 160 endpoint pairs. Example from the report:
Seven distinct call sites become one edge with one
source_location. Andrelation_variant_groups: 57means 57 pairs collapsed edges that did not even share a relation type — acallsand areferencesbetween the same two nodes keep only whichever landed first.Why it matters beyond tidiness
suggest_questions) is computed on a flattened graph.source_locationfor the surviving edge is arbitrary, so "where exactly does A use B" has one answer out of seven, with nothing marking it as partial.graph may be incomplete/corruptafter the fact; there is no flag to re-run without the loss, so the only response is to accept it.Suggested fix, in order of cost
weight(orcount) to the number of merged edges and carrysource_locationsas a list. No API change for consumers that ignore the extra fields, and the diagnostic drops to zero for the common case.--multigraphto build aMultiGraph/MultiDiGraphfor users who want every edge. Note graphify explain/path still crash on MultiGraph edge access #796 and merge-graphs: unhandled NetworkXError on mixed directed/multigraph inputs, and exit code 0 on crash #1606 showexplain/path/merge-graphshave had MultiGraph edge-access bugs before, so this is the expensive option and (1) probably delivers most of the value.diagnose multigraphalready computes everything needed for (1) — the numbers above came straight out of it.