Japanese
言語
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.converters.circuit_to_dag

circuit_to_dag(circuit)[ソース]

Build a DAGCircuit object from a QuantumCircuit.

パラメータ

circuit (QuantumCircuit) – the input circuit.

戻り値

the DAG representing the input circuit.

戻り値の型

DAGCircuit

サンプル

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.dagcircuit import DAGCircuit
from qiskit.converters import circuit_to_dag
from qiskit.visualization import dag_drawer
%matplotlib inline

q = QuantumRegister(3, 'q')
c = ClassicalRegister(3, 'c')
circ = QuantumCircuit(q, c)
circ.h(q[0])
circ.cx(q[0], q[1])
circ.measure(q[0], c[0])
circ.rz(0.5, q[1]).c_if(c, 2)
dag = circuit_to_dag(circ)
dag_drawer(dag)
../_images/qiskit.converters.circuit_to_dag_0_0.png