Conversation
CONDOR seeds its community structure with igraph's randomised Leiden algorithm, so the integer community labels it returns are arbitrary and get permuted between igraph releases. The old test pinned the exact labels with assert_frame_equal against per-igraph-version ground-truth files, which is why two copies existed: they encode the identical partition (adjusted Rand index 1.0) with different numbering. The rewritten tests never compare raw labels. They check the partition against a single reference up to relabelling (ARI >= 0.9), that the final bipartite modularity is at least the reference value (the objective CONDOR maximises), the structure of the output, that a fixed seed is reproducible and that results are stable across seeds, plus the command-line entry point. Outputs go to pytest's tmp_path instead of the repository root. The now-redundant *_v9igraph ground-truth files are removed. In condor.py, drop two debug prints that fired even in silent mode and route Leiden through a helper that tolerates igraph's rename of resolution_parameter to resolution, which silences the deprecation warning on current igraph while keeping older versions working. Fixes netZoo#320 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Assert the final modularity matches the reference instead of being at least as large: ARI already pins the partition, so ">=" only lost the ability to catch a wrong modularity value (a bipartite_modularity that returned 2*Q passed the whole suite). - Run the CLI test with initial_method="LDN". The click default is Louvain, whose result varies with the seed and with igraph's RNG stream (10-29% of seeds reach a different BRIM optimum across igraph versions); Leiden reaches the reference partition for every seed. - Only fall back to resolution_parameter= when the TypeError is about that keyword, so unrelated TypeErrors are not retried under the deprecated argument. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #320 (follow-up to #312).
Problem
CONDOR initialises its community structure with igraph's randomised Leiden algorithm, so the integer community labels it returns are arbitrary and get permuted between igraph releases.
tests/test_condor.pypinned the exact labels withassert_frame_equalagainst per-igraph-version ground-truth files — which is why bothgh_*_memb.txtandgh_*_memb_v9igraph.txtexisted. Comparing them shows they encode the identical partition (adjusted Rand index = 1.000) with different numbering. The test was fragile to any igraph update, and the point made in #312 stands: a single fixed labelling is not the right thing to assert on.Changes
tests/test_condor.py— rewritten so it never compares raw labels:bipartite_modularitynow fails the suite);netzoopy condorCLI path, run withinitial_method="LDN": the CLI default is Louvain, and depending on igraph's RNG stream 10–29% of seeds reach a different BRIM optimum (Q 0.5246, ARI 0.78), whereas Leiden reaches the reference partition for every seed tested (500/500 across igraph 0.9.11–1.0.0);tmp_pathinstead of the repo root (the old test lefttar2.txt/reg2.txtetc. behind as untracked files).netZooPy/condor/condor.py(small):prints that fired even withsilent=True;_leidenhelper that uses igraph's currentresolution=keyword and falls back to the deprecatedresolution_parameter=only when that keyword is rejected (igraph < 0.10.3). Verified empirically: fallback taken on igraph 0.10.0–0.10.2, primary branch with no deprecation warning on 0.10.4 / 0.10.8 / 0.11.2 / 1.0.0, identical modularity throughout.Removed the now-redundant
tests/condor/gh_*_memb_v9igraph.txt(nothing references them).Verification
CI note (unrelated to this PR)
The workflow currently fails on
tests/test_dragon.py::test_dragonandtests/test_panda.py::test_panda, which are untouched here: bothcurl -Otheir data fromnetzoo.s3.us-east-2.amazonaws.comat test time, and that bucket now returns403 AccessDenied, so the XML error body is written over the data file.tests/test_condor.pypasses in the same runs. This affects every branch (includingdevelon its next run) until the bucket permissions are restored or the tests stop depending on S3.Out of scope (pre-existing, surfaced during review)
run_condor(..., initial_project=True)raisesIndexErrorininitial_community(projection path).--resolutiontoinitial_community, and declares ittype=int.🤖 Generated with Claude Code