Skip to content

Check within_block / a and between_block / b in planted_partition() - #65

Draft
alexpghayes wants to merge 1 commit into
mainfrom
fix/planted-partition-args
Draft

alexpghayes wants to merge 1 commit into
mainfrom
fix/planted-partition-args

Conversation

@alexpghayes

Copy link
Copy Markdown
Collaborator

Bug

planted_partition() (R/undirected_planted_partition.R) silently ignored a when within_block was given, and b when between_block was given. With neither given it failed with the cryptic "replacement diagonal has wrong length".

Fix

Copy the argument checks from directed_planted_partition():

  • within_block, between_block, a and b must be scalars;
  • "Must specify only one of within_blockanda." (and likewise for between_block / b);
  • "Must specify either within_blockandbetween_block, or aandb." when either probability is missing.

Mixing the two parameterizations (e.g. within_block with b) still works, as in the directed version.

Tests

Added to tests/testthat/test-undirected-planted-partition.R. Fails on main (2 failures, 1 error), passes here. Full suite passes. No man/ changes.

NEWS

Left out to avoid conflicting with #59. Suggested bullet under Bug fixes:

  • planted_partition() now errors when both within_block and a (or both between_block and b) are given, instead of silently ignoring a / b, and gives a clear error when either probability is missing.

🤖 Generated with Claude Code

planted_partition() silently ignored `a` when `within_block` was given
(and `b` when `between_block` was given), and with neither failed with
"replacement diagonal has wrong length". Copy the argument checks from
directed_planted_partition(): each probability must be given exactly
one way, and both are required.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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