Skip to content

bug fix in smallworld.py: random_reference and lattice_reference#6151

Merged
MridulS merged 8 commits intonetworkx:mainfrom
paulitapb:bug_fix_smallworld
Dec 20, 2022
Merged

bug fix in smallworld.py: random_reference and lattice_reference#6151
MridulS merged 8 commits intonetworkx:mainfrom
paulitapb:bug_fix_smallworld

Conversation

@paulitapb
Copy link
Copy Markdown
Member

Closes #6150.

Changed random_reference, and lattice_reference, now an exception is raised if the function is called with a graph with fewer than 2 edges. Also updated the documentation.

Copy link
Copy Markdown
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

This LGTM - this produces a much more informative exception for situations that already raise exceptions. Thanks @paulitapb !

@jarrodmillman jarrodmillman added this to the networkx-3.0 milestone Nov 22, 2022
@rossbar rossbar modified the milestones: networkx-3.0, networkx-3.1 Nov 29, 2022
@MridulS
Copy link
Copy Markdown
Member

MridulS commented Dec 12, 2022

@paulitapb could you review the comments by @rossbar?
Once they are resolved we can merge this in.

paulitapb and others added 2 commits December 12, 2022 13:12
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
@rossbar
Copy link
Copy Markdown
Contributor

rossbar commented Dec 13, 2022

FWIW the errors here seem to be due to various misspellings in the exception checking - should be an easy fix!


for o in omegas:
assert -1 <= o <= 1

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.

Suggested change

The tests will need separation by two blank lines.

@MridulS MridulS merged commit 9d5e11f into networkx:main Dec 20, 2022
MridulS pushed a commit to MridulS/networkx that referenced this pull request Feb 4, 2023
…workx#6151)

* raise exception if graph has less than 2 edges in random_reference and lattice_reference and tested

* Updated lattice_reference doc

* Update networkx/algorithms/smallworld.py

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>

* Update networkx/algorithms/tests/test_smallworld.py

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>

* Added some suggestions

* Added some final suggestions

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
…workx#6151)

* raise exception if graph has less than 2 edges in random_reference and lattice_reference and tested

* Updated lattice_reference doc

* Update networkx/algorithms/smallworld.py

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>

* Update networkx/algorithms/tests/test_smallworld.py

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>

* Added some suggestions

* Added some final suggestions

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

In smallworld.py: ZeroDivisionError when passing a graph without edges

5 participants