Qiskit / rustworkx

A high performance Python graph library implemented in Rust.
https://www.rustworkx.org
Apache License 2.0
1.03k stars 145 forks source link

Degree centrality support #1129

Open Paulo-21 opened 6 months ago

Paulo-21 commented 6 months ago

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

IvanIsCoding commented 6 months ago

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

TheMLEngineer commented 5 months ago

Hi @IvanIsCoding , I want to start contributing. As this is my first time, requesting more info on the requirement. Thanks for your time.

IvanIsCoding commented 5 months ago

Hi @IvanIsCoding , I want to start contributing. As this is my first time, requesting more info on the requirement. Thanks for your time.

  1. Understand the formula for Degree Centrality
  2. Read https://github.com/Qiskit/rustworkx/blob/main/CONTRIBUTING.md
  3. 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
  4. Then wrap your pure Rust function into a Python function in https://github.com/Qiskit/rustworkx/blob/main/src/centrality.rs
  5. Test it https://github.com/Qiskit/rustworkx/blob/main/tests/graph/test_centrality.py
TheMLEngineer commented 5 months ago

Thanks , Will submit code

TheMLEngineer commented 5 months ago

Submitted pull request https://github.com/Qiskit/rustworkx/pull/1145