Degree centrality support
What is the expected enhancement?
It would be nice if Rustworkx could support the Degree_centraly features like Networkx. https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.centrality.degree_centrality.html
Out of all the centralities discussed in #441, I firmly belive this is one of the easiest ones.
This would be a good first contribution for the folks that want to get started with the library
Hi @IvanIsCoding , I want to start contributing. As this is my first time, requesting more info on the requirement. Thanks for your time.
Hi @IvanIsCoding , I want to start contributing. As this is my first time, requesting more info on the requirement. Thanks for your time.
- Understand the formula for Degree Centrality
- Read https://github.com/Qiskit/rustworkx/blob/main/CONTRIBUTING.md
- You want to add a pure Rust function in https://github.com/Qiskit/rustworkx/blob/main/rustworkx-core/src/centrality.rs like the other centralities
- Then wrap your pure Rust function into a Python function in https://github.com/Qiskit/rustworkx/blob/main/src/centrality.rs
- Test it https://github.com/Qiskit/rustworkx/blob/main/tests/graph/test_centrality.py
Thanks , Will submit code
Submitted pull request https://github.com/Qiskit/rustworkx/pull/1145
Submitted another pull request with the appropriate fixes: #1306