-
Notifications
You must be signed in to change notification settings - Fork 176
Add parallelism to cloness_centrality
#1392
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
Conversation
Pull Request Test Coverage Report for Build 14346065276Details
💛 - Coveralls |
Because #1387, I added a test to boost the coverage in the report. I am confident the Rust tests guarantee the correctness so for now that is a stop gap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, it makes a lot of sense to run this with rayon. Thanks for doing this. I just left a couple of comments inline the main one is I think we can do this without a mutex using a rayon iterator collection into the vec which should be faster..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks much better to me now, thanks for making the change. I just had a couple of small inline comments about the release notes and the docstring updates. But code-wise I think this is good to go.
releasenotes/notes/parallel-closeness-centrality-5165f62e370181eb.yaml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks fine now, besides the lint failure. The RAYON_NUM_THREADS
doesn't look like it's in the Python docs though, we normally document it there too because it's an env variable and works from python too.
Let me update the Python docs and fix the formatting |
This PR makes
closeness_centrality
andnewman_weighted_closeness_centrality
parallel for better performance. This is possible because the task is embarrassingly parallel.We probably missed this in #593 but #1385 reminded me of it.
The parallelism is toggled via the
parallel_threshold
just like other centrality methods.