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 immediate_dominators function #1323

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

airwoodix
Copy link
Contributor

@airwoodix airwoodix commented Nov 19, 2024

If I didn't miss it, dominance-related functionality is not yet exposed. Apologies if I missed it.

This patch adds a rustworkx.immediate_dominators function that has the same functionality as networkx.immediate_dominators. The core functionality is directly provided by the petgraph crate, such that only a thin Python binding was necessary.

The tests are directly ported from those in networkx.

An equivalent to networkx.dominance_frontiers could be added in a later patch.

@airwoodix airwoodix marked this pull request as ready for review November 19, 2024 08:42
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 submitting this! It is a welcome addition.

I just left some minor comments but overall this is very close to getting merged and released in 0.16

Note: and Clippy has some gotchas too but those should be easy to fix. Run cargo clippy or look at the CI failure for the lint output

tests/digraph/test_dominance.py Outdated Show resolved Hide resolved
src/dominance.rs Outdated Show resolved Hide resolved
rustworkx/rustworkx.pyi Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@IvanIsCoding IvanIsCoding added this to the 0.16.0 milestone Nov 20, 2024
@airwoodix airwoodix force-pushed the digraph-immediate-dominators branch from 380cb63 to 0e0030c Compare November 20, 2024 07:17
@airwoodix airwoodix changed the title Add digraph_immediate_dominators function Add immediate_dominators function Nov 20, 2024
@airwoodix airwoodix force-pushed the digraph-immediate-dominators branch from 0e0030c to 6a887c2 Compare November 20, 2024 07:25
@airwoodix airwoodix force-pushed the digraph-immediate-dominators branch from 6a887c2 to e6e89f8 Compare November 20, 2024 07:31
@airwoodix
Copy link
Contributor Author

airwoodix commented Nov 20, 2024

Thanks for the review!

I addressed the comments and rebased the branch.

Following the new function's renaming, I edited the PR title and description.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11928735689

Details

  • 26 of 26 (100.0%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.005%) to 95.863%

Files with Coverage Reduction New Missed Lines %
rustworkx-core/src/generators/random_graph.rs 2 85.04%
Totals Coverage Status
Change from base Build 11923243578: -0.005%
Covered Lines: 18259
Relevant Lines: 19047

💛 - Coveralls

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.

Fantastic. This should come out when 0.16 is released 🚀

@IvanIsCoding IvanIsCoding added this pull request to the merge queue Nov 20, 2024
Merged via the queue into Qiskit:main with commit 537f67f Nov 20, 2024
31 checks passed
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.

3 participants