Repository navigation
ENH: add n_samples parameter to rich_club_coefficient for multi-sample averaging - #8721
Merged
Merged
Conversation
dschult
reviewed
Jul 1, 2026
Comment on lines
+41
to
+43
| `n_samples` reduces the likelyhood of a ZeroDivisionError for sparse | ||
| graphs with few high-degree nodes. | ||
| in the case that the average of their rich-club coefficients are all 0. |
Member
There was a problem hiding this comment.
Please check spelling and punctuation here.
Also can we state something like: Only relevant when normalized is True.
And the same phrase should go in the seed argument I think.
Contributor
Author
|
These are all great suggestions. Will work on implementing this! |
- Fixed spelling/grammar in docstring - Made n_samples keyword-only - Added py_random_state decorator - Changed exception from Exception to ValueError - Added test comment referencing networkxgh-8485
amcandio
approved these changes
Jul 11, 2026
dschult
approved these changes
Jul 14, 2026
dschult
left a comment
Member
There was a problem hiding this comment.
I took the liberty of updating the doc_string Raises section and adjust the exception messages (and merge with main). Those are the only remaining open comments on this PR.
I approve this and think its ready. @amcandio can you verify that this is the adjustment to the Raises section you intended and if so, merge? Thanks!
Thanks @magnuls for this PR!
rossbar
reviewed
Jul 16, 2026
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 #8485
Adds an n_samples parameter (defaults to 1) to rich_club_coefficient that generates multiple random graphs and averages their rich-club coefficients for normalization. I try to follow the same multi-sample averaging approach described by @dschult in #8485.
My Changes:
Tests added:
ZeroDivisionError#8485)