question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DAG.width needs to be updated to match QuantumCircuit definition

See original GitHub issue

Information

  • Qiskit Terra version: master
  • Python version:
  • Operating system:

What is the current behavior?


qr = QuantumRegister(5,'qr')
cr = ClassicalRegister(5, 'cr')
ghz = QuantumCircuit(qr, cr, name='ghz')

ghz.h(qr[2])
ghz.cx(qr[2], qr[1])
ghz.cx(qr[1], qr[0])
ghz.cx(qr[2], qr[3])
ghz.cx(qr[3], qr[4])
ghz.draw()

ghz_dag = circuit_to_dag(ghz)

print(ghz.width(), ghz_dag.width())

gives: (10, 5).

Steps to reproduce the problem

What is the expected behavior?

Suggested solutions

DAG width needs to count both qubits and cbits for self-consistency.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jwoehrcommented, Jul 16, 2019

Per @ajavadia 's comments after merge of #2708 I’ll proceed to

  1. Search for invocations or mentions of DAGCircuit.num_cbits() and change to DAGCircuit.num_clbits()
  • qiskit-tutorials/qiskit/terra/advanced_circuits.ipynb
  • qiskit-aqua/qiskit/aqua/utils/circuit_utils.py
  • qiskit/docs/terra/custom_gates.rst
  1. Remove DAGCircuit.num_cbits()
  2. Search for current usage of DAGCircuit.width() and replace with DAGCircuit.num_qbits()
  3. After such invocations are changed, DAGCircuit.width() can be changed to return the total number of bits (qubits + clbits) fulfilling the intent of this issue.
1reaction
nonhermitiancommented, Jun 28, 2019

It probably breaks several things which is why it has not been implemented yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

qiskit.dagcircuit.dagcircuit — Qiskit 0.19.6 documentation
Object to represent a quantum circuit as a directed acyclic graph (DAG). ... Operation nodes have equal in- and out-degrees and carry #...
Read more >
Q-circuit Tutorial - UNM Physics & Astronomy
Q-circuit is a list of macros that greatly simplifies the construction of quantum circuit diagrams. (QCDs) in LATEX with the help of the...
Read more >
Release notes — PennyLane 0.28.0 documentation
A new transform has been added to construct the pairwise-commutation directed acyclic graph (DAG) representation of a quantum circuit.
Read more >
The Parallel Reversible Pebbling Game: Analyzing the Post ...
(2) We show that any (e, d)-reducible DAG has reversible space-time complexity ... If we instantiate fG,H with a quantum circuit of width...
Read more >
Detecting crosstalk errors in quantum information processors
ous definition of crosstalk errors that captures the ef- fects of crosstalk, while avoiding the need ... circuit, Markovian quantum circuit, and Markovian,....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found