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

Fix dag visualization for DAGCircuits without registers (backport #7923) #7938

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 14, 2022

This is an automatic backport of pull request #7923 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

* Fix dag visualization for DAGCircuits without registers

This commit fixes the handling of generating visualizations for
DAGCircuit objects that have standalone bit objects. Previously, the
dag_drawer() function was assuming every bit in the dag was a member of
a register. In the case of circuits with standalone bits this is not the
case and would result in a KeyError being raised when the register was
attempted to be used to generate a string label for the node or edge
in the visualization. This fixes this by still using registers if
present, but in the absence of a register it fallsback to using it's
absolute index in the dag to generate a similar label. For example, the
4th qubit will have the label "q[4]" in the output visualization.

Fixes #7915

* Adjust default label from q[0] to q_0

This commit changes the default fallback label when no register match is
found to be of the form q_0, where 0 is the qubit index. This was done
to avoid potential confusion with a register named q which might be in
the circuit and not the first element in the qubits list.

* Add release note

* Add test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 4463ac3)
@mergify mergify bot requested review from a team, nonhermitian and nkanazawa1989 as code owners April 14, 2022 15:01
@qiskit-bot
Copy link
Collaborator

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:

  • @Qiskit/terra-core

@mtreinish mtreinish added Changelog: Bugfix Include in the "Fixed" section of the changelog automerge labels Apr 14, 2022
@mergify mergify bot merged commit da42266 into stable/0.20 Apr 14, 2022
@mergify mergify bot deleted the mergify/bp/stable/0.20/pr-7923 branch April 14, 2022 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants