DAGCircuit¶
- class DAGCircuit[fuente]¶
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 DAGOpNodes and DAGInNodes.
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 2q "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.Return a copy of self with the same structure but empty.
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 DAGOpNodes and DAGOutNodes.
Draws the dag circuit.
Iterator for edge values and source and dest node
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 DAGOpNodes, DAGInNodes, and DAGOutNodes.
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 DAGOpNodes and DAGInNodes.
Return a dictionary of circuit properties.
Returns iterator of the predecessors of a node that are connected by a quantum edge as DAGOpNodes and DAGInNodes.
Returns iterator of the successors of a node that are connected by a quantum edge as Opnodes and DAGOutNodes.
Remove all operation nodes with the given name.
Remove all of the ancestor operation nodes of node.
Remove classical bits from the circuit.
Remove classical registers from the circuit, leaving underlying bits in place.
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.
Remove classical registers from the circuit, leaving underlying bits in place.
Remove quantum bits from the circuit.
Replace a block of nodes with a single node.
Reverse the operations in the
self
circuit.Yield a layer for all gates of this circuit.
Return the number of operations.
Replace an DAGOpNode with a single operation.
Replace one node with dag.
Returns iterator of the successors of a node as DAGOpNodes and DAGOutNodes.
Yield nodes in topological order.
Yield op nodes in topological order.
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.