Repository navigation
Conversation
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).
ccc840e to
14f8eb3
Compare
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. 2 change(s) tested, no difference found (not proven).
Graphify review — findings
Propagates the caller's resolution into _split_community so the oversized- and low-cohesion-community split passes re-run Leiden at the same resolution cluster used for the whole graph, instead of hardcoding 1.0. Adds tests asserting _split_community forwards its resolution to _partition and that cluster passes --resolution through to both split passes.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 472 functions depend on the 49 functions this change touches.
Health — this change adds coupling hotspots:
- new:
_rebuild_code()— 113 callers, 50 callees - new:
dispatch_command()— 2 callers, 123 callees - new:
_make_graph()— 32 callers, 6 callees - new:
cluster()— 62 callers, 3 callees - new:
run_pipeline()— 8 callers, 13 callees - new:
make_inputs()— 14 callers, 5 callees - new:
suggest_questions()— 11 callers, 4 callees - new:
watch()— 5 callers, 7 callees - …and 11 more — each is listed as a finding
Verification — 472 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: 278 function(s) in the blast radius were not formally verified this run
Formal verification
No difference found (not proven): No behavior difference found in cluster (not a proof).
The verifier ran both versions of cluster on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
No difference found (not proven): No behavior difference found in \_split\_community (not a proof).
The verifier ran both versions of \_split\_community on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
· 19 more finding(s) on lines outside this diff (see the check run).
_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.
|
I measured this PR's effect on two real graphs, in case it helps the review. Setup
Mean number of communities (full
(Leiden = On On the smaller graph the two versions are identical at resolution 2.8 and above, where no split pass runs. Below 1.0 this PR makes the output coarser in a specific way: the number of communities changes little (21–24 between 0.5 and 1.0, 17 at 0.25), while the largest community grows, from 77 to 97 to 298 nodes at 1.0, 0.5 and 0.25 (Leiden, 12-seed means; 312 with Louvain at 0.25). One point for the review: the 25% bound. The
On Scripts, graphs and results, with a |
14f8eb3 to
5e17de6
Compare
_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).