Skip to content

Fix: bug with mean degree part of geometric_soft_configuration_model - #8726

Merged
dschult merged 2 commits into
networkx:mainfrom
robertjankowski:S1-model-bug-fix
Jul 2, 2026
Merged

dschult merged 2 commits into
networkx:mainfrom
robertjankowski:S1-model-bug-fix

Conversation

@robertjankowski

Copy link
Copy Markdown
Contributor

The average degree was computed incorrectly when the user input a list of kappa-s. Since it is a dict, one needs to use the .values() function. All tests are passing.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @robertjankowski , this does seem to be a clear bug!

There's a minor issue with the regression test in that it also passes on main, thus not reliably covering the bug (it's also a bit expensive). I've proposed an alternative - LMK what you think.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the liberty of applying the suggested test update - @dschult is right it does fail on main (I missed the - 10) but it is significantly longer to set up.

Regardless - this is a clear bug and should go in before the next release. Thanks @robertjankowski !

@dschult dschult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@dschult dschult changed the title Fix: bug with mean degree of geometric soft configuration model Fix: bug with mean degree part of geometric_soft_configuration_model Jul 2, 2026
@dschult
dschult merged commit e9eac8a into networkx:main Jul 2, 2026
43 checks passed
@dschult dschult added this to the 3.7 milestone Jul 2, 2026
toastmt pushed a commit to toastmt/networkx that referenced this pull request Jul 2, 2026
…etworkx#8726)

* fix bug with mean degree of S1 model

* Update networkx/generators/tests/test_geometric.py

---------

Co-authored-by: Ross Barnowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants