Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #5012 implementation of newman watts strogatz graph inconsistent with model #5015

Conversation

mingxuan-he
Copy link

This PR fixes issue #5012 by modifying the implementation to allow multi-edges and self-loops in the model. The description for the Newman-Watts-Strogatz algorithm can be found in: Newman, M.E.J., Watts, D.J.: Scaling and percolation in the small-world network model. Phys.Rev. E60(6), 7332–7342 (1999). https://doi.org/10.1103/PhysRevE.60.7332

Also adds a simple test for the other extreme case p=1.

@dschult
Copy link
Member

dschult commented Aug 19, 2021

I have looked into this description and agree with many items. The newly cited paper provides a better description of how to handle the question of selfloops and multiedges than the current citation in NetworkX. Unfortunately it is also different from our current function and that will cause backward incompatibility. Note that the current implementation is not incorrect given the less precise description in the currently cited paper. I also notice that the name involves 3 authors and neither paper is written by strogatz.

I suggest that we implement this change as follows:

  • retain the current function newman_watts_strogatz_graph and add words in the doc_string to describe how self-loops and multiedges are avoided. It should also "see also" the new function described next.
  • create a new function (perhaps newman_watts_graph ?) that returns a MultiGraph and handles the selfloops and multiedges as in the cited paper suggested by this PR.

What do you think? It avoids backward incompatibility by keeping the simple graph interpretation available, yet makes the analytically tractable version available too.

@mingxuan-he
Copy link
Author

That's a great suggestion! I'll work on it

@rossbar
Copy link
Contributor

rossbar commented Jun 27, 2022

Gentle ping @mingxuan-he - are you still working on this one?

@MridulS
Copy link
Member

MridulS commented Nov 11, 2023

@mingxuan-he thanks for the PR!

This hasn't been touched in a while. I'll go ahead and close this. Feel free to send a new PR :)
Thanks!

@MridulS MridulS closed this Nov 11, 2023
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.

None yet

4 participants