rustworkx icon indicating copy to clipboard operation
rustworkx copied to clipboard

Degree centrality support

Open Paulo-21 opened this issue 1 year ago • 6 comments

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

Paulo-21 avatar Mar 03 '24 20:03 Paulo-21

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

IvanIsCoding avatar Mar 03 '24 21:03 IvanIsCoding

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

TheMLEngineer avatar Mar 11 '24 20:03 TheMLEngineer

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

IvanIsCoding avatar Mar 12 '24 02:03 IvanIsCoding

Thanks , Will submit code

TheMLEngineer avatar Mar 12 '24 19:03 TheMLEngineer

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

TheMLEngineer avatar Mar 17 '24 20:03 TheMLEngineer

Submitted another pull request with the appropriate fixes: #1306

Gohlub avatar Nov 03 '24 16:11 Gohlub