Portuguese
Idiomas
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

DAGCircuit

class DAGCircuit[código fonte]

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

add_calibration

Register a low-level, custom pulse definition for the given gate.

add_clbits

Add individual clbit wires.

add_creg

Add all wires in a classical register.

add_qreg

Add all wires in a quantum register.

add_qubits

Add individual qubit wires.

ancestors

Returns set of the ancestors of a node as DAGOpNodes and DAGInNodes.

apply_operation_back

Apply an operation to the output of the circuit.

apply_operation_front

Apply an operation to the input of the circuit.

bfs_successors

Returns an iterator of tuples of (DAGNode, [DAGNodes]) where the DAGNode is the current node and [DAGNode] is its successors in BFS order.

collect_1q_runs

Return a set of non-conditional runs of 1q "op" nodes.

collect_2q_runs

Return a set of non-conditional runs of 2q "op" nodes.

collect_runs

Return a set of non-conditional runs of "op" nodes with the given names.

compose

Compose the other circuit onto the output of this circuit.

copy_empty_like

Return a copy of self with the same structure but empty.

count_ops

Count the occurrences of operation names.

count_ops_longest_path

Count the occurrences of operation names on the longest path.

depth

Return the circuit depth.

descendants

Returns set of the descendants of a node as DAGOpNodes and DAGOutNodes.

draw

Draws the dag circuit.

edges

Iterator for edge values and source and dest node

from_networkx

Take a networkx MultiDigraph and create a new DAGCircuit.

front_layer

Return a list of op nodes in the first layer of this dag.

gate_nodes

Get the list of gate nodes in the dag.

has_calibration_for

Return True if the dag has a calibration defined for the node operation.

idle_wires

Return idle wires.

is_predecessor

Checks if a second node is in the predecessors of node.

is_successor

Checks if a second node is in the successors of node.

layers

Yield a shallow view on a layer of this DAGCircuit for all d layers of this circuit.

longest_path

Returns the longest path in the dag as a list of DAGOpNodes, DAGInNodes, and DAGOutNodes.

multi_qubit_ops

Get list of 3+ qubit operations.

multigraph_layers

Yield layers of the multigraph.

named_nodes

Get the set of "op" nodes with the given name.

node

Get the node in the dag.

nodes

Iterator for node values.

nodes_on_wire

Iterator for nodes that affect a given wire.

num_clbits

Return the total number of classical bits used by the circuit.

num_qubits

Return the total number of qubits used by the circuit.

num_tensor_factors

Compute how many components the circuit can decompose into.

op_nodes

Get the list of "op" nodes in the dag.

predecessors

Returns iterator of the predecessors of a node as DAGOpNodes and DAGInNodes.

properties

Return a dictionary of circuit properties.

quantum_predecessors

Returns iterator of the predecessors of a node that are connected by a quantum edge as DAGOpNodes and DAGInNodes.

quantum_successors

Returns iterator of the successors of a node that are connected by a quantum edge as Opnodes and DAGOutNodes.

remove_all_ops_named

Remove all operation nodes with the given name.

remove_ancestors_of

Remove all of the ancestor operation nodes of node.

remove_clbits

Remove classical bits from the circuit.

remove_cregs

Remove classical registers from the circuit, leaving underlying bits in place.

remove_descendants_of

Remove all of the descendant operation nodes of node.

remove_nonancestors_of

Remove all of the non-ancestors operation nodes of node.

remove_nondescendants_of

Remove all of the non-descendants operation nodes of node.

remove_op_node

Remove an operation node n.

remove_qregs

Remove classical registers from the circuit, leaving underlying bits in place.

remove_qubits

Remove quantum bits from the circuit.

replace_block_with_op

Replace a block of nodes with a single.

reverse_ops

Reverse the operations in the self circuit.

serial_layers

Yield a layer for all gates of this circuit.

size

Return the number of operations.

substitute_node

Replace an DAGOpNode with a single instruction.

substitute_node_with_dag

Replace one node with dag.

successors

Returns iterator of the successors of a node as DAGOpNodes and DAGOutNodes.

to_networkx

Returns a copy of the DAGCircuit in networkx format.

topological_nodes

Yield nodes in topological order.

topological_op_nodes

Yield op nodes in topological order.

two_qubit_ops

Get list of 2 qubit operations.

width

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.