Add DAGCircuit method to replace block of nodes with another set of nodes#9863
Add DAGCircuit method to replace block of nodes with another set of nodes#9863ewinston wants to merge 1 commit intoQiskit:mainfrom
Conversation
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
|
I did push up a PR to rustworkx to add a native method for doing this based on our earlier discussion: Qiskit/rustworkx#823 when that is merged and in a rustworkx release we can update the internals of this DAGCircuit method to use it. |
|
Thanks @mtreinish! I didn't see that. I can update the PR after it merges. |
Pull Request Test Coverage Report for Build 4545100440
💛 - Coveralls |
Summary
When optimizing circuits one often knows a transformation of a subcircuit into a more desirable form. If the initial subcircuit is listed as a set of nodes of a DAGCircuit this can be replaced by another set of nodes.
Details and comments
This works by using
DAGCirucit.replace_block_with_opand thenDAGCircuit.substitute_node_with_dagto apply the transformation.