Skip to content

Conversation

Krishn1412
Copy link
Contributor

Added a fuzz target for cycle check validation and idempotency check (calling contract_nodes twice doesn't crash).

Added a fuzz target for cycle check validation and idempotency check (calling contract_nodes twice doesn't crash)
@coveralls
Copy link

coveralls commented Apr 22, 2025

Pull Request Test Coverage Report for Build 14759015542

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.372%

Totals Coverage Status
Change from base Build 14523987150: 0.0%
Covered Lines: 18651
Relevant Lines: 19556

💛 - Coveralls

@IvanIsCoding
Copy link
Collaborator

I will start reviewing the PRs starting from this sometime around today/tomorrow

@Krishn1412
Copy link
Contributor Author

Hey @IvanIsCoding, did you get time to review these?

@IvanIsCoding
Copy link
Collaborator

Hey @IvanIsCoding, did you get time to review these?

Not yet, I will try to review this and #1337 it’s what on the top of my list

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.

Overall LGTM, minor Rust style comment


// Run contraction with cycle check (may fail)
let result = graph.contract_nodes(to_contract.clone(), input.replacement_weight, true);
if let Err(ContractError::DAGWouldCycle) = result {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use a match call, with the Ok(_) branch covering the idempotency and the Err branch checking for ContractError::DAGWouldCycle

Something along the lines

match graph.contract_nodes(...) {
     Ok(_) => { /* idempotency */},
     Err(_) => {/* dag cycle */ }
}

@IvanIsCoding IvanIsCoding added this pull request to the merge queue Apr 30, 2025
Merged via the queue into Qiskit:main with commit 30f2907 Apr 30, 2025
31 checks passed
SILIZ4 pushed a commit to SILIZ4/rustworkx that referenced this pull request Jul 4, 2025
* Adding fuzz target for contraction

Added a fuzz target for cycle check validation and idempotency check (calling contract_nodes twice doesn't crash)

* Fixing Lint issues

* Updates based on comments
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