-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add assortativity
to torch_geometric.utils
#5587
Merged
Merged
Conversation
This file contains 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
rusty1s
approved these changes
Oct 1, 2022
Padarn
reviewed
Oct 2, 2022
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
Co-authored-by: Padarn Wilson <padarn.wilson@grabtaxi.com>
rusty1s
approved these changes
Oct 5, 2022
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.
Looks good to me. Please also add it to the CHANGELOG.md
.
Codecov Report
@@ Coverage Diff @@
## master #5587 +/- ##
==========================================
+ Coverage 83.85% 83.88% +0.02%
==========================================
Files 348 349 +1
Lines 19169 19200 +31
==========================================
+ Hits 16074 16105 +31
Misses 3095 3095
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
JakubPietrakIntel
pushed a commit
to JakubPietrakIntel/pytorch_geometric
that referenced
this pull request
Nov 25, 2022
* add assortativity * test * doc-string * doc-string * Update torch_geometric/utils/assortativity.py Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de> * Update torch_geometric/utils/assortativity.py Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de> * Update torch_geometric/utils/assortativity.py Co-authored-by: Padarn Wilson <padarn.wilson@grabtaxi.com> * update test * doc-string * fix test * changelog Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de> Co-authored-by: Padarn Wilson <padarn.wilson@grabtaxi.com>
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.
This PR implements the computation of degree assortativity coefficient, as described in Mixing patterns in networks. Assortativity is a preference for a network's nodes to attach to others that are similar in some way. A larger assortativity indicates nodes tend to be connected with other nodes with similar degree values, and vice versa. Link to Slack Discussion
The implementation is based on
networkx.degree_assortativity_coefficient
but much faster than usingnetworkx
.Test
networkx.degree_assortativity_coefficient
torch_geometric.utils.assortativity
(On CPU)torch_geometric.utils.assortativity
(On GPU)The slight difference in results is caused by two different frameworks (Numpy and PyTorch).