DAGDependency¶

class
DAGDependency
[소스]¶ 기반 클래스:
object
Object to represent a quantum circuit as a directed acyclic graph via operation dependencies (i.e. lack of commutation).
The nodes in the graph are operations represented by quantum gates. The edges correspond to noncommutation between two operations (i.e. a dependency). A directed edge from node A to node B means that operation A does not commute with operation B. The object’s methods allow circuits to be constructed.
The nodes in the graph have the following attributes: ‘operation’, ‘successors’, ‘predecessors’.
Example:
Bell circuit with no measurement.
┌───┐ qr_0: ┤ H ├──■── └───┘┌─┴─┐ qr_1: ─────┤ X ├ └───┘
The dependency DAG for the above circuit is represented by two nodes. The first one corresponds to Hadamard gate, the second one to the CNOT gate as the gates do not commute there is an edge between the two nodes.
Reference:
[1] Iten, R., Moyard, R., Metger, T., Sutter, D. and Woerner, S., 2020. Exact and practical pattern matching for quantum circuit optimization. arXiv:1909.05270
Create an empty DAGDependency.
Methods
Add individual clbit wires.
Add clbits in a classical register.
Add a DAGDepNode to the graph and update the edges.
Add qubits in a quantum register.
Add individual qubit wires.
Function to copy a DAGDependency object.
Return the circuit depth.
Direct predecessors id of a given node as sorted list.
Direct successors id of a given node as sorted list.
Draws the DAGDependency graph.
Enumeration of all edges.
Edge enumeration between two nodes through method get_all_edge_data.
Enumeration of all incoming edges for a given node.
 param node_id
label of considered node.
 returns
iterator over all the nodes.
Enumeration of all outgoing edges for a given node.
Predecessors id of a given node as sorted list.
Returns the number of gates in the circuit
Successors id of a given node as sorted list.
Returns a copy of the DAGDependency in networkx format.
Returns the DAGDependency in retworkx format.
Yield nodes in topological order.
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.