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

Add more centrality measures #441

Open
georgios-ts opened this issue Sep 8, 2021 · 0 comments
Open

Add more centrality measures #441

georgios-ts opened this issue Sep 8, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@georgios-ts
Copy link
Collaborator

@georgios-ts georgios-ts added enhancement New feature or request good first issue Good for newcomers labels Sep 8, 2021
mtreinish added a commit to mtreinish/retworkx that referenced this issue Jun 4, 2022
This commit adds a new function eigenvector_centrality() to compute the
eigenvector centrality of a graph. It uses the same power function
approach that the NetworkX function eigenvector_centrality() [1]
function uses. This is for two reasons, the first is that a more
traditional eigenvector linear algebra/BLAS function would either
require us to link against BLAS at build time (which is a big change
in the build system and a large requirement) or to call out to numpy
via python both of which seemed less than ideal. The second reason was
to make handling holes in node indices bit easier. Using this approach
also enabled us to put the implementation in retworkx-core so it can be
reused with any petgraph graph.

Part of Qiskit#441
mergify bot pushed a commit that referenced this issue Jun 11, 2022
* Add Eigenvector centrality function

This commit adds a new function eigenvector_centrality() to compute the
eigenvector centrality of a graph. It uses the same power function
approach that the NetworkX function eigenvector_centrality() [1]
function uses. This is for two reasons, the first is that a more
traditional eigenvector linear algebra/BLAS function would either
require us to link against BLAS at build time (which is a big change
in the build system and a large requirement) or to call out to numpy
via python both of which seemed less than ideal. The second reason was
to make handling holes in node indices bit easier. Using this approach
also enabled us to put the implementation in retworkx-core so it can be
reused with any petgraph graph.

Part of #441

* Fix issues with docstrings

Co-authored-by: georgios-ts <[email protected]>

* Correct default value of max_iter

Co-authored-by: georgios-ts <[email protected]>

* Apply suggestions from code review

Co-authored-by: georgios-ts <[email protected]>

* Fix compiler warning

* Switch to a Vec<f64> instead of HashMap to track centrality

* Update retworkx-core tests too

* Fix handling of parallel edges

This commit fixes an issue where we were overcounting parallel edges in
the graph. There was a bug in the logic that was calculating the
combined weight of parallel edges incorrectly.

Co-authored-by: georgios-ts <[email protected]>

* Precompute weight edges from python interface

This commit changes the callback from the retworkx functions for
determining edge weight to precompute them to avoid requiring a python
context in the callback. This make a minor improvement in runtime since
we only callback to python once at the very beginning instead of in the
middle of the loop.

* Apply suggestions from code review

Co-authored-by: georgios-ts <[email protected]>

* Update src/centrality.rs

Co-authored-by: georgios-ts <[email protected]>

* Add docs to toc

Co-authored-by: georgios-ts <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant