Repository navigation
Description
Summary
graphify explain and some path/MCP edge-rendering paths still access edges as if the graph is always a simple Graph:
edata = G.edges[nid, nb]
edata = G.edges[u, v]When graph.json has already loaded successfully as a NetworkX MultiGraph / MultiDiGraph, this crashes during rendering with:
ValueError: not enough values to unpack (expected 3, got 2)
This issue is not about the edges/links node-link key mismatch. That was a separate loader/schema compatibility bug. The failure reported here happens after the graph loads and is specifically about MultiGraph edge access.
This is the same bug class as #305, but #305's v0.4.11 fix was applied to _subgraph_to_text() / query rendering only, not all CLI/MCP call sites.
Environment
- Package:
graphifyy - Version:
0.7.11 - Python:
3.14viauv run --with graphifyy==0.7.11 - NetworkX: version installed by
graphifyy==0.7.11 - OS/runtime: Linux aarch64
Reproduction
Use any node-link graph.json that NetworkX loads as a multigraph, for example one with multigraph: true or parallel edges between the same source/target pair.
Then run:
uv run --with graphifyy==0.7.11 graphify explain "REQ-003: Document And PPM Generation" --graph graph.jsonObserved output:
Node: REQ-003: Document And PPM Generation
ID: req_003_document_ppm_generation
Source: architecture/feature/req-003-document-and-ppm-generation.md None
Type: document
Community:
Degree: 1
Connections (1):
Traceback (most recent call last):
File ".../bin/graphify", line 10, in <module>
sys.exit(main())
File ".../site-packages/graphify/__main__.py", line 1558, in main
edata = G.edges[nid, nb]
~~~~~~~^^^^^^^^^
File ".../site-packages/networkx/classes/reportviews.py", line 1368, in __getitem__
u, v, k = e
ValueError: not enough values to unpack (expected 3, got 2)
I also see the same simple-Graph access pattern in path rendering:
# graphify/__main__.py path/explain call sites in v0.7.11
edata = G.edges[u, v]
edata = G.edges[nid, nb]Expected behavior
All CLI/MCP graph operations should handle both simple graphs and multigraphs consistently.
For a MultiGraph/MultiDiGraph, edge data access should use G[u][v] and select one or iterate all parallel edge attribute dicts.
Likely fix
Centralize edge-data access in a helper and replace direct G.edges[u, v] / G.edges[nid, nb] lookups:
def _edge_data_for_pair(G, u, v):
raw = G[u][v]
if isinstance(G, (nx.MultiGraph, nx.MultiDiGraph)):
return next(iter(raw.values()), {})
return rawFor commands that should show all relations, use an iterator instead:
def _edge_datas_for_pair(G, u, v):
raw = G[u][v]
if isinstance(G, (nx.MultiGraph, nx.MultiDiGraph)):
return list(raw.values())
return [raw]Then explain can either print the first edge or all parallel relations.
Related
- Bug Report:
graphify querycrashes with ValueError #305 fixed the same bug class forquery/_subgraph_to_text()in v0.4.11. - [build] Add multigraph option to preserve parallel edges #709 is related because it discusses preserving parallel edges and adding more MultiGraph support, but the current crash exists in released
graphifyy==0.7.11.
Activity
fix MultiGraph crash, hollow LLM response retry, and skill --help (#796…
safishamsi commentedon May 9, 2026
Fixed in v0.7.12 — added
edge_data(G, u, v)helper inbuild.pythat handles bothnx.Graphandnx.MultiGraph/nx.MultiDiGraph. All call sites inserve.py,wiki.py,export.py,analyze.py, andbenchmark.pyupdated.build/sweep: lap-29 cherry-pick Graphify-Labs#796 — edge_data() helpe…
fix MultiGraph crash, hollow LLM response retry, and skill --help (Gr…
fix MultiGraph crash, hollow LLM response retry, and skill --help (Gr…