Summary
graphify cluster-only always invokes to_html() regardless of --no-viz flag or GRAPHIFY_VIZ_NODE_LIMIT=0 env var. On graphs with ≥ 5000 nodes this raises ValueError and aborts the run after the new clusters are written to graph.json but before .graphify_labels.json is saved, leaving the graph in an inconsistent state.
Reproduce
Tested on graphifyy 0.7.7 (Python 3.13.12, macOS).
# graph.json with 7060 nodes, 22213 edges
graphify cluster-only . --no-viz # crashes
GRAPHIFY_VIZ_NODE_LIMIT=0 graphify cluster-only . # crashes
Expected
Either flag/env should bypass to_html() entirely. Per v0.6.6 release notes:
--no-viz flag now works in cluster-only path — removes stale graph.html when passed (#565)
GRAPHIFY_VIZ_NODE_LIMIT env var — override the 5000-node HTML threshold (set to 0 to disable viz entirely, useful for CI) (#565)
Actual
Loading existing graph...
Graph: 7060 nodes, 22213 edges
Re-clustering...
Traceback (most recent call last):
File "/opt/homebrew/bin/graphify", line 6, in <module>
sys.exit(main())
File ".../graphify/__main__.py", line 1415, in main
to_html(G, communities, str(out / "graph.html"), community_labels=labels or None)
File ".../graphify/export.py", line 395, in to_html
raise ValueError(...)
ValueError: Graph has 7060 nodes - too large for HTML viz. Use --no-viz or reduce input size.
Likely cause
__main__.py:1415 calls to_html(...) unconditionally on the cluster-only branch — looks like the flag/env guards present elsewhere are missing on this code path (regression vs v0.6.6, or the v0.6.6 fix never reached cluster-only).
Side effect
graph.json is saved with the new cluster IDs (good), but .graphify_labels.json is not written (bad — community label persistence relies on it, per v0.6.6 fix #558). Subsequent --update runs lose human-readable labels.
Environment
- graphifyy 0.7.7 (pipx install)
- Python 3.13.12
- macOS Darwin 25.4.0
- Graph: 7060 nodes / 22213 edges / 314 communities
Workaround
None — graphs ≥ 5000 nodes cannot run cluster-only at all on v0.7.7.
Summary
graphify cluster-onlyalways invokesto_html()regardless of--no-vizflag orGRAPHIFY_VIZ_NODE_LIMIT=0env var. On graphs with ≥ 5000 nodes this raisesValueErrorand aborts the run after the new clusters are written tograph.jsonbut before.graphify_labels.jsonis saved, leaving the graph in an inconsistent state.Reproduce
Tested on graphifyy 0.7.7 (Python 3.13.12, macOS).
Expected
Either flag/env should bypass
to_html()entirely. Per v0.6.6 release notes:Actual
Likely cause
__main__.py:1415callsto_html(...)unconditionally on the cluster-only branch — looks like the flag/env guards present elsewhere are missing on this code path (regression vs v0.6.6, or the v0.6.6 fix never reachedcluster-only).Side effect
graph.jsonis saved with the new cluster IDs (good), but.graphify_labels.jsonis not written (bad — community label persistence relies on it, per v0.6.6 fix #558). Subsequent--updateruns lose human-readable labels.Environment
Workaround
None — graphs ≥ 5000 nodes cannot run
cluster-onlyat all on v0.7.7.