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

Degree centrality implementation #1306

Merged
merged 10 commits into from
Nov 18, 2024

Conversation

Gohlub
Copy link
Contributor

@Gohlub Gohlub commented Nov 3, 2024

Proposed a solution for #1129. The implementation is straightforward, though I wonder whether I should add a flag to support in-degree and out-degree centrality, and support for weighted graphs (since the current implementation assumes an unweighted graph). Let me know what you think!

@CLAassistant
Copy link

CLAassistant commented Nov 3, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@IvanIsCoding IvanIsCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making your first contribution. I left some comments, but some things to note:

Also, I noticed from the CLA bot that this PR has two authors. This is quite unusual for a first contribution so please let me know if you are:

  1. Working on a college assignment together
  2. One of the users flagged by the bot is an AI Assistant

There is nothing wrong with either, but it can help me review the PR accordingly.

.gitignore Show resolved Hide resolved
degree_centrality_implementation_rustworkx.md Outdated Show resolved Hide resolved
rustworkx-core/src/centrality.rs Outdated Show resolved Hide resolved
rustworkx/__init__.pyi Outdated Show resolved Hide resolved
src/centrality.rs Outdated Show resolved Hide resolved
tests/graph/test_centrality.py Outdated Show resolved Hide resolved
tests/graph/test_centrality.py Outdated Show resolved Hide resolved
@IvanIsCoding
Copy link
Collaborator

Also, we can handle in_degree and out_degree in a separate PR. These methods would only be for PyDiGraph. They probably would reuse most of the existing code as I pointed out in the comment, but it requires more tests and all that.

@Gohlub
Copy link
Contributor Author

Gohlub commented Nov 3, 2024

Hi, thank you for the swift feedback! I just wanted to note that this was in fact a college assignment, with the other contributor being my classmate. However we are now moving on to individual work, so I will be responsible for the next steps. I will be begin addressing your suggestions shortly.

@IvanIsCoding
Copy link
Collaborator

Hi, thank you for the swift feedback! I just wanted to note that this was in fact a college assignment, with the other contributor being my classmate. However we are now moving on to individual work, so I will be responsible for the next steps. I will be begin addressing your suggestions shortly.

Sounds good to me, just remember to ask your classmate(s) to sign the CLA otherwise the bot will not let it get merged

rustworkx-core/src/centrality.rs Outdated Show resolved Hide resolved
tests/graph/test_centrality.py Outdated Show resolved Hide resolved
@IvanIsCoding IvanIsCoding added this to the 0.16.0 milestone Nov 16, 2024
@Gohlub Gohlub force-pushed the degree_centrality_implementation branch from 8def920 to 19548f3 Compare November 17, 2024 22:52
@Gohlub
Copy link
Contributor Author

Gohlub commented Nov 17, 2024

I tried to rebase to amend a commit my friend made, but I think I inadvertently added things to the PR that should not be there. What is the course of action here?

@IvanIsCoding
Copy link
Collaborator

Keep "Maintainers are allowed to edit this pull request." active as it is right now and don't do further pushes. I will do a force push with the diff only and take it from here.

I will add you as an author and your classmate as co-author.

Co-authored-by: Gohlub [email protected]
Co-authored-by: onsali [email protected]
@IvanIsCoding IvanIsCoding force-pushed the degree_centrality_implementation branch from 51d6196 to 0ff1242 Compare November 18, 2024 02:22
@Qiskit Qiskit deleted a comment from CLAassistant Nov 18, 2024
@IvanIsCoding
Copy link
Collaborator

IvanIsCoding commented Nov 18, 2024

Just to let you know about the changes I made:

Nevertheless, thanks for getting this started it was a lot of help

@coveralls
Copy link

coveralls commented Nov 18, 2024

Pull Request Test Coverage Report for Build 11885136415

Details

  • 87 of 87 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 95.853%

Totals Coverage Status
Change from base Build 11866861155: 0.02%
Covered Lines: 18212
Relevant Lines: 19000

💛 - Coveralls

@IvanIsCoding IvanIsCoding added this pull request to the merge queue Nov 18, 2024
Merged via the queue into Qiskit:main with commit 2cf35c0 Nov 18, 2024
31 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Dec 17, 2024
* Add release notes for #1292

* Add release notes for degree centrality

* Add centrality entries to the docs

* Update releasenotes/notes/accept-generators-31f080871015233c.yaml

Co-authored-by: Matthew Treinish <[email protected]>

* Update releasenotes/notes/accept-generators-31f080871015233c.yaml

---------

Co-authored-by: Matthew Treinish <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants