Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK Go to the latest version

qiskit.dagcircuit.DAGNode

class DAGNode(type=None, op=None, name=None, qargs=None, cargs=None, wire=None, nid=- 1)

GitHub

Object to represent the information at a node in the DAGCircuit.

It is used as the return value from *_nodes() functions and can be supplied to functions that take a node.

Create a node

__init__

__init__(type=None, op=None, name=None, qargs=None, cargs=None, wire=None, nid=- 1)

Create a node


Methods

__init__([type, op, name, qargs, cargs, …])Create a node
semantic_eq(node1, node2[, bit_indices1, …])Check if DAG nodes are considered equivalent, e.g., as a node_match for nx.is_isomorphic.

Attributes

cargs
conditionReturns the condition of the node.op
nameReturns the Instruction name corresponding to the op for this node
opReturns the Instruction object corresponding to the op for the node, else None
qargsReturns list of Qubit, else an empty list.
sort_key
type
wireReturns the Bit object, else None.

condition

Returns the condition of the node.op

name

Returns the Instruction name corresponding to the op for this node

op

Returns the Instruction object corresponding to the op for the node, else None

qargs

Returns list of Qubit, else an empty list.

semantic_eq

static semantic_eq(node1, node2, bit_indices1=None, bit_indices2=None)

Check if DAG nodes are considered equivalent, e.g., as a node_match for nx.is_isomorphic.

Parameters

  • node1 (DAGNode) – A node to compare.
  • node2 (DAGNode) – The other node to compare.
  • bit_indices1 (dict) – Dictionary mapping Bit instances to their index within the circuit containing node1
  • bit_indices2 (dict) – Dictionary mapping Bit instances to their index within the circuit containing node2

Returns

If node1 == node2

Return type

Bool

wire

Returns the Bit object, else None.

Was this page helpful?
Report a bug or request content on GitHub.