Quantum circuit as a directed acyclic graph.
There are 3 types of nodes in the graph: inputs, outputs, and operations. The nodes are connected by directed edges that correspond to qubits and bits.
Create an empty circuit.
Return calibration dictionary.
Return a list of classical bits (as a list of Clbit instances).
Return the global phase of the circuit.
Returns the number of nodes in the dag.
Return a list of qubits (as a list of Qubit instances).
Return a list of the wires in order.
Add all wires in a classical register.
Add all wires in a quantum register.
Returns set of the ancestors of a node as DAGNodes.
DAGCircuit.apply_operation_back(op[, qargs, …])
Apply an operation to the output of the circuit.
DAGCircuit.apply_operation_front(op, qargs, …)
Apply an operation to the input of the circuit.
Returns an iterator of tuples of (DAGNode, [DAGNodes]) where the DAGNode is the current node and [DAGNode] is its successors in BFS order.
Return a set of non-conditional runs of “op” nodes with the given names.
DAGCircuit.compose(other[, edge_map, …])
othercircuit onto the output of this circuit.
DEPRECATED: use DAGCircuit.compose() instead.
Count the occurrences of operation names.
Count the occurrences of operation names on the longest path.
Return the circuit depth.
Returns set of the descendants of a node as DAGNodes.
DAGCircuit.draw([scale, filename, style])
Draws the dag circuit.
Iterator for edge values and source and dest node
DEPRECATED: Add dag at the end of self, using edge_map.
Take a networkx MultiDigraph and create a new DAGCircuit.
Return a list of op nodes in the first layer of this dag.
Get the list of gate nodes in the dag.
Return True if the dag has a calibration defined for the node operation.
Return idle wires.
Yield a shallow view on a layer of this DAGCircuit for all d layers of this circuit.
Returns the longest path in the dag as a list of DAGNodes.
Get list of 3+ qubit operations.
Yield layers of the multigraph.
Get the set of “op” nodes with the given name.
Get the node in the dag.
Iterator for node values.
Iterator for nodes that affect a given wire.
Return the total number of classical bits used by the circuit.
Return the total number of qubits used by the circuit.
Compute how many components the circuit can decompose into.
Get the list of “op” nodes in the dag.
Returns iterator of the predecessors of a node as DAGNodes.
Return a dictionary of circuit properties.
Returns iterator of the predecessors of a node that are connected by a quantum edge as DAGNodes.
Returns iterator of the successors of a node that are connected by a quantum edge as DAGNodes.
Remove all operation nodes with the given name.
Remove all of the ancestor operation nodes of node.
Remove all of the descendant operation nodes of node.
Remove all of the non-ancestors operation nodes of node.
Remove all of the non-descendants operation nodes of node.
Remove an operation node n.
Reverse the operations in the
Yield a layer for all gates of this circuit.
Return the number of operations.
DAGCircuit.substitute_node(node, op[, inplace])
Replace a DAGNode with a single instruction.
Replace one node with dag.
Returns iterator of the successors of a node as DAGNodes.
Get list of 3-or-more-qubit gates: (id, data).
Returns a copy of the DAGCircuit in networkx format.
Yield nodes in topological order.
Yield op nodes in topological order.
Get list of 2-qubit gates.
Get list of 2 qubit operations.
Return the total number of qubits + clbits used by the circuit.