Skip to content

Sample directed edges in Erdos-Renyi null models - #1545

Merged
SkBlaz merged 1 commit into
masterfrom
fix/daily-nullmodel-scan-20261006
Oct 6, 2026
Merged

SkBlaz merged 1 commit into
masterfrom
fix/daily-nullmodel-scan-20261006

Conversation

@SkBlaz

@SkBlaz SkBlaz commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Erdős–Rényi null models for directed networks currently use an undirected sampler and the undirected density denominator. A complete four-node digraph with 12 arcs becomes a graph with only 6 arcs, all oriented according to node order. This biases the null distribution used for hypothesis testing.

Use the input graph's directionality for the sampling probability, NetworkX generator, and output network. Directed graphs sample ordered pairs at m/(n*(n-1)); undirected sampling remains unchanged. Document the expected-density semantics.

Validation:

  • Original code: 5 new regression failures and 7 passing controls.
  • Fixed code: all 12 new cases pass, including complete digraphs, seeded sparse graphs, isolated nodes, and the executor.
  • Combined regression and related suites: 76 passing tests on Python 3.12 and Python 3.9. Three additional Erdős–Rényi property tests pass on Python 3.12.
  • One unrelated seed-contract test fails identically on unchanged master and the fixed branch: tests/test_nullmodels_contracts.py::test_generate_null_model_uses_per_sample_seeds_consistently. It expects seed+i instead of the executor's spawned child seeds; deselected only for the Python 3.9 validation.
  • Focused Ruff F/B checks and git diff --check pass.

@SkBlaz
SkBlaz merged commit 3a96f21 into master Oct 6, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant