-
Notifications
You must be signed in to change notification settings - Fork 28
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
Katz centrality #370
Katz centrality #370
Conversation
New function in , computes the Katz-centrality for hypergraph. This commit does not passe all tests yet (bug with the namespace when importing ).
The function katz_centrality was not mentionned in __all__ in file xgi/algorithms/centrality.py. Docstring was also completed in katz_centrality.
Run pylint xgi/ --disable all --enable W0611, isort . and black .. Updated CHANGELOG.md.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #370 +/- ##
==========================================
+ Coverage 90.74% 90.90% +0.15%
==========================================
Files 42 42
Lines 3113 3178 +65
==========================================
+ Hits 2825 2889 +64
- Misses 288 289 +1
☔ View full report in Codecov by Sentry. |
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.
Hey @acombretrenouard thank you so much for your work on this! This is almost ready, just left some minor things :)
xgi/algorithms/centrality.py
Outdated
If index is set to True, nodedict will contain the nodes ids, keyed by their indice in vector c. | ||
<c[key]> will be the centrality of node <nodedict[key]>. | ||
|
||
Note |
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.
Check out this link to see how to markup LaTeX within a docstring.
Also, the section title should be Notes
, note Note
(sphinx is very fussy about this...)
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 put variables in between ``, is that ok ?
Thanks a lot Antoine, great work. Just a question: what values can this take? |
Yeah, I did this in in the clique eigenvector centrality because the eigenvector is not guaranteed to be in the correct direction (it can have all positive entries or all negative entries). |
Thank you for your comments ! I tried to take them into account. The current version should be much better. |
Hello again ! I added the minor fixes you mentioned. On the normalization : the Katz-centrality counts the number of walks starting from a single node. This is a local feature (as there is the exponential attenuation of walks). In this sense, the Katz centrality is a sort of 'clustering coefficient'. Conversely, normalizing would add the global contribution of every other node. Maybe this is what we want to reflect ? |
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.
Nice work! The only thing is that there is a duplicate import but I will fix that once it's merged in.
Thanks Antoine ! |
New Katz centrality algorithms, computed with a power-series over the adjacency matrix.
Another option would be a direct matrix inversion (computationally harder ?).
The usual contribution pipeline runs without errors (
pytest
,isort .
, etc...).