Repository navigation
Description
Summary
graphify query fails to load a graph.json that contains edges but no links:
error: could not load graph: 'links'
This looks like the same node-link key compatibility class as #738, but affecting the query/path/explain loading paths.
Environment
- Package:
graphifyy - Version observed:
0.7.9 - Python:
3.12.3 - OS/runtime: Linux aarch64
- NetworkX installed by
uvx --from graphifyy
Reproduction
- Generate or obtain a
graph.jsonshaped like this:
{
"nodes": [{"id": "a", "label": "A"}, {"id": "b", "label": "B"}],
"edges": [{"source": "a", "target": "b", "relation": "calls"}],
"hyperedges": []
}- Run:
uvx --from graphifyy graphify query "A" --graph graph.jsonActual behavior
error: could not load graph: 'links'
In my repo benchmark, the generated graph artifact had content but only an edges key:
nodes: 694
edges: 1993
links key present: false
Copying edges to links made graphify query load the same graph, so this is not a partial-index problem; it is a loader/schema compatibility problem.
Expected behavior
graphify query, graphify path, and graphify explain should accept both historical/current node-link edge keys:
linksedges
If links is missing and edges is present, the loader should normalize the input before calling networkx.readwrite.json_graph.node_link_graph(..., edges="links"), or otherwise call NetworkX with the matching edge-key name.
Likely fix
Use a tolerant node-link loader everywhere query/path/explain load a graph, similar to the merge compatibility fix from #738:
def _load_node_link(data):
if "links" not in data and "edges" in data:
data = dict(data, links=data["edges"])
try:
return json_graph.node_link_graph(data, edges="links")
except TypeError:
return json_graph.node_link_graph(data)The important bit is to handle KeyError: 'links' / missing-key compatibility, not just the NetworkX-version TypeError fallback.
Related
- merge-graphs fails when graph.json uses "edges" key instead of expected "links" key #738:
merge-graphsalready hit anedgesvslinksmismatch. - graphify query fails on NetworkX < 3.4: node_link_graph() got an unexpected keyword argument 'edges' #95 /
graphifycrashes when exportinggraphify-out/graph.json. #149: related NetworkX node-link compatibility problems.
Activity
safishamsi commentedon May 7, 2026
Fixed in aa2bd13 - added
edges→linksnormalization to all four load sites:query,path,explainin__main__.pyand_load_graphinserve.py. Same pattern as the #738 fix for merge-graphs.fix edges/links key mismatch in query, path, explain, and MCP loader (#…
loaders: lap-28 — mirror edges→links for newer NetworkX graph.json (PR …
fix edges/links key mismatch in query, path, explain, and MCP loader (G…