-
Notifications
You must be signed in to change notification settings - Fork 161
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 Katz Centrality #797
Add Katz Centrality #797
Conversation
Pull Request Test Coverage Report for Build 5139295387
💛 - Coveralls |
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 LGTM, it's a simple modification to the eigenvector centrality to compute the katz centrality. Just a couple comments inline.
rustworkx-core/src/centrality.rs
Outdated
for node_index in graph.node_identifiers() { | ||
let node = graph.to_index(node_index); | ||
if !beta.contains_key(&node) { | ||
return Ok(None); // beta_map was provided but did not include all nodes |
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.
Should this be an error instead of None
? It feels like a user error if they pass in a mapping that's incomplete here.
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.
None means it’s not defined… it map to an error in Python but in Rust we let the caller handle it
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.
LGTM, thanks for making the updates
Related to #441
Add the Katz centrality to both rustworkx and rustworkx-core. I mostly forked the code from
eigenvector_centrality
and made the adaptations