-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove old graph structure during
EquivalenceLibrary.set_entry
(#11959
) (#11963) * Remove old graph structure during `EquivalenceLibrary.set_entry` The previous implementation of `EquivalenceLibrary.set_entry` changed the equivalence rules attached to particular nodes within the graph structure, but didn't correctly update the edges, so the graph was no longer representing the correct data, and queries within `BasisTranslator` would still use the old equivalence sets. This correctly clears out the old rules and adds the new structure when `set_entry` is used. The inner private variable `_rule_count` is replaced with `_rule_id`, since it would actually be misleading for its use to decrement it; this could cause clashes, and what's actually intended and used is that it's an id for rules. * Add test with parallel edges (cherry picked from commit 67e0243) Co-authored-by: Jake Lishman <[email protected]>
- Loading branch information
1 parent
2cd034b
commit 0397f45
Showing
3 changed files
with
95 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
releasenotes/notes/fix-equivalence-setentry-5a30b0790666fcf2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
fixes: | ||
- | | ||
Calling :meth:`.EquivalenceLibrary.set_entry` will now correctly update the internal graph | ||
object of the library. Previously, the metadata would be updated, but the graph structure would | ||
be unaltered, meaning that users like :class:`.BasisTranslator` would still use the old rules. | ||
Fixed `#11958 <https://github.com/Qiskit/qiskit/issues/11958>`__. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters