qiskit-documentation/docs/api/qiskit/0.26/qiskit.dagcircuit.DAGNode.mdx

90 lines
4.9 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: DAGNode
description: API reference for qiskit.dagcircuit.DAGNode
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.dagcircuit.DAGNode
---
# qiskit.dagcircuit.DAGNode
<Class id="qiskit.dagcircuit.DAGNode" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.17/qiskit/dagcircuit/dagnode.py" signature="DAGNode(type=None, op=None, name=None, qargs=None, cargs=None, wire=None, nid=- 1)" modifiers="class">
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\_\_
<Function id="qiskit.dagcircuit.DAGNode.__init__" signature="__init__(type=None, op=None, name=None, qargs=None, cargs=None, wire=None, nid=- 1)">
Create a node
</Function>
## Methods
| | |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [`__init__`](#qiskit.dagcircuit.DAGNode.__init__ "qiskit.dagcircuit.DAGNode.__init__")(\[type, op, name, qargs, cargs, …]) | Create a node |
| [`semantic_eq`](#qiskit.dagcircuit.DAGNode.semantic_eq "qiskit.dagcircuit.DAGNode.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` | |
| [`condition`](#qiskit.dagcircuit.DAGNode.condition "qiskit.dagcircuit.DAGNode.condition") | Returns the condition of the node.op |
| `name` | |
| [`op`](#qiskit.dagcircuit.DAGNode.op "qiskit.dagcircuit.DAGNode.op") | Returns the Instruction object corresponding to the op for the node, else None |
| [`qargs`](#qiskit.dagcircuit.DAGNode.qargs "qiskit.dagcircuit.DAGNode.qargs") | Returns list of Qubit, else an empty list. |
| `sort_key` | |
| `type` | |
| [`wire`](#qiskit.dagcircuit.DAGNode.wire "qiskit.dagcircuit.DAGNode.wire") | Returns the Bit object, else None. |
### condition
<Attribute id="qiskit.dagcircuit.DAGNode.condition">
Returns the condition of the node.op
</Attribute>
### op
<Attribute id="qiskit.dagcircuit.DAGNode.op">
Returns the Instruction object corresponding to the op for the node, else None
</Attribute>
### qargs
<Attribute id="qiskit.dagcircuit.DAGNode.qargs">
Returns list of Qubit, else an empty list.
</Attribute>
### semantic\_eq
<Function id="qiskit.dagcircuit.DAGNode.semantic_eq" signature="semantic_eq(node1, node2, bit_indices1=None, bit_indices2=None)" modifiers="static">
Check if DAG nodes are considered equivalent, e.g., as a node\_match for nx.is\_isomorphic.
**Parameters**
* **node1** ([*DAGNode*](#qiskit.dagcircuit.DAGNode "qiskit.dagcircuit.DAGNode")) A node to compare.
* **node2** ([*DAGNode*](#qiskit.dagcircuit.DAGNode "qiskit.dagcircuit.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
</Function>
### wire
<Attribute id="qiskit.dagcircuit.DAGNode.wire">
Returns the Bit object, else None.
</Attribute>
</Class>