fix(cluster): honor --resolution on the community split passes - #2388
fix(cluster): honor --resolution on the community split passes#2388keith-oak wants to merge 1 commit into
Conversation
_split_community() called _partition() with the default resolution of 1.0, so --resolution applied to the top-level partition but was silently dropped by both split passes (the oversized-community split and the cohesion re-split). A run with --resolution 0.5 could therefore have its large communities re-partitioned at 1.0, contradicting the flag. Thread cluster()'s resolution through to both call sites. Default behaviour is unchanged (1.0 either way); only explicit --resolution runs differ.
There was a problem hiding this comment.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
This PR threads the resolution parameter through the community-splitting logic in graphify/cluster.py. Previously _split_community always ran its secondary Leiden partition with the default resolution of 1.0; now cluster() passes its own resolution value down to both the oversized-community and low-cohesion split passes, and _split_community forwards it to _partition. Two new tests verify that the resolution is forwarded from _split_community to _partition and from cluster into the split passes.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 363 functions depend on the 38 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
cluster()— 61 callers, 3 callees
Verification — 363 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 210 function(s) in the blast radius were not formally verified this run
· 1 more finding(s) on lines outside this diff (see the check run).
_split_community()calls_partition()without forwardingresolution, so it always re-partitions at the default1.0.cluster(resolution=...)(the--resolutionflag added in 2d783e5) therefore applies to the top-level partition but is silently dropped by both split passes:cluster.py:214)cluster.py:223)So
graphify build --resolution 0.5partitions the graph at 0.5, then re-partitions its largest communities at 1.0 — the opposite granularity to the one requested.Change
Thread
cluster()'sresolutionthrough to both call sites and give_split_community()aresolution: float = 1.0parameter.Default behaviour is unchanged — the default is 1.0 either way, which is what the split passes were already hardcoding. Only runs that pass an explicit
--resolutionchange.Tests
Two tests in
tests/test_cluster.py, both verified to fail without the fix:test_split_community_forwards_resolution_to_partition— asserts the kwarg reaches_partitiontest_cluster_forwards_resolution_to_split_passes— end-to-end throughcluster()on a graph that trips the oversized-split pathFull suite: 3904 passed, 36 skipped. Two failures on this branch are pre-existing on a clean
v8checkout and unrelated (test_ollama_retry_cap.pyneeds theopenaiextra;test_labeling.py::test_label_communities_batches_when_over_batch_sizeasserts a batch completion order).