Repository navigation
Validate block_sizes and reject pi with block_sizes in dcsbm() - #64
Draft
alexpghayes wants to merge 1 commit into
Draft
alexpghayes wants to merge 1 commit into
alexpghayes wants to merge 1 commit into
Conversation
The block membership branches in dcsbm() were ordered so that the "both given" check was unreachable: with `block_sizes` set, `pi` was silently ignored. `block_sizes` was only checked for its sum, so non-integer sizes silently dropped nodes and the wrong length failed inside rep(). Check "both given" first and validate `block_sizes` with check_block_sizes(), as directed_dcsbm() does. Also update the docs: block sizes are fixed by default (since 0.4.0), and fix the symmetrization formula for `B`. Co-Authored-By: Claude Opus 5.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.
Bug
In
dcsbm(), the!is.null(block_sizes)branch came before the "both given" check, so that check (and the finalelse) was unreachable, and its error message was wrong.block_sizeswas only checked for its sum. This affectssbm()andplanted_partition()too, since they calldcsbm().Fix
"Must specify only one ofblock_sizesandpi, not both.", matching the wording forB/k.block_sizeswithcheck_block_sizes()fromR/directed_dcsbm.R: non-negative integers, lengthk, sumn.balanced_block_sizes()for the default instead of an inline copy.Docs
pi, but fixed balanced sizes have been the default since 0.4.0. They now describe both.pino longer saysblock_sizes"takes precedence"; specifying both is an error.Bsymmetrization formula:B := (B + t(B)) / 2, notB + t(B) / 2(shared withsbm(),planted_partition(),mmsbm()docs).Docs regenerated with roxygen2 7.3.2.
Tests
New
tests/testthat/test-dcsbm-block-sizes.R. Fails onmain(3 failures, 1 error), passes here. Full suite passes.NEWS
Left out to avoid conflicting with #59. Suggested bullet under Bug fixes:
🤖 Generated with Claude Code