DAGCircuit¶
-
class
DAGCircuit
[source]¶ Bases:
object
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.
Methods
Register a low-level, custom pulse definition for the given gate.
Add individual clbit wires.
Add all wires in a classical register.
Add all wires in a quantum register.
Add individual qubit wires.
Returns set of the ancestors of a node as DAGNodes.
Apply an operation to the output of the circuit.
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 1q “op” nodes.
Return a set of non-conditional runs of “op” nodes with the given names.
Compose the
other
circuit 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.
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.
Checks if a second node is in the predecessors of node.
Checks if a second node is in the successors of node.
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
self
circuit.Yield a layer for all gates of this circuit.
Return the number of operations.
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.
Attributes
-
calibrations
¶ Return calibration dictionary.
- The custom pulse definition of a given gate is of the form
{‘gate_name’: {(qubits, params): schedule}}
-
global_phase
¶ Return the global phase of the circuit.
-
node_counter
¶ Returns the number of nodes in the dag.
-
wires
¶ Return a list of the wires in order.
-