---
title: Node (latest version)
description: API reference for samplomatic.samplex.nodes.Node in the latest version of samplomatic
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/samplex-nodes-node
---

# Node

*class* `samplomatic.samplex.nodes.Node`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L27-L180)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Parent class for samplex node operations.

**Attributes Summary**

|                                                                                                                                            |                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| [`num_parameters`](#samplomatic.samplex.nodes.Node.num_parameters "samplomatic.samplex.nodes.Node.num_parameters")                         | The number of parameter values this node requires at sampling time.               |
| [`outgoing_register_type`](#samplomatic.samplex.nodes.Node.outgoing_register_type "samplomatic.samplex.nodes.Node.outgoing_register_type") | The virtual gate type of outgoing registers.                                      |
| [`parameter_idxs`](#samplomatic.samplex.nodes.Node.parameter_idxs "samplomatic.samplex.nodes.Node.parameter_idxs")                         | Which evaluated parameter expressions this node needs access to at sampling time. |
| [`trace_info`](#samplomatic.samplex.nodes.Node.trace_info "samplomatic.samplex.nodes.Node.trace_info")                                     | Debug trace information linking this node back to its originating box(es).        |

**Methods Summary**

|                                                                                                                                                           |                                                                                  |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [`get_style`](#samplomatic.samplex.nodes.Node.get_style "samplomatic.samplex.nodes.Node.get_style")()                                                     | Return the style of this node when plotted.                                      |
| [`instantiates`](#samplomatic.samplex.nodes.Node.instantiates "samplomatic.samplex.nodes.Node.instantiates")()                                            | Return a manifest of new virtual registers that this node instantiates.          |
| [`outputs_to`](#samplomatic.samplex.nodes.Node.outputs_to "samplomatic.samplex.nodes.Node.outputs_to")()                                                  | Return the set of names of outputs this node mutates.                            |
| [`reads_from`](#samplomatic.samplex.nodes.Node.reads_from "samplomatic.samplex.nodes.Node.reads_from")()                                                  | Return a manifest of which virtual register values this node needs to read from. |
| [`removes`](#samplomatic.samplex.nodes.Node.removes "samplomatic.samplex.nodes.Node.removes")()                                                           | Return a manifest of virtual registers that this node removes.                   |
| [`validate_and_update`](#samplomatic.samplex.nodes.Node.validate_and_update "samplomatic.samplex.nodes.Node.validate_and_update")(register\_descriptions) | Validate provided register descriptions are compatible, update with changes.     |
| [`writes_to`](#samplomatic.samplex.nodes.Node.writes_to "samplomatic.samplex.nodes.Node.writes_to")()                                                     | Return a manifest of which virtual register values this node needs to write to.  |

**Attributes Documentation**

### num\_parameters

The number of parameter values this node requires at sampling time.

### outgoing\_register\_type

The virtual gate type of outgoing registers.

### parameter\_idxs

Which evaluated parameter expressions this node needs access to at sampling time.

### trace\_info

Debug trace information linking this node back to its originating box(es).

Populated only when the samplex was built with `debug=True`. Contains annotation metadata such as tag and inject-noise refs from the box(es) that produced this node. This information is not serialized.

**Methods Documentation**

### get\_style

`get_style() → NodeStyle`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L162-L177)

Return the style of this node when plotted.

### instantiates

`instantiates() → dict[str, tuple[int, VirtualType]]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L80-L88)

Return a manifest of new virtual registers that this node instantiates.

> **Note**
>
> - To change the type or size of a register, both instantiate and remove it.
> - Do not specify [`reads_from()`](#samplomatic.samplex.nodes.Node.reads_from "samplomatic.samplex.nodes.Node.reads_from") or [`writes_to()`](#samplomatic.samplex.nodes.Node.writes_to "samplomatic.samplex.nodes.Node.writes_to") for an instantiated register, these powers are implicit.

### outputs\_to

`outputs_to() → set[str]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L68-L70)

Return the set of names of outputs this node mutates.

### reads\_from

`reads_from() → dict[str, tuple[set[int], VirtualType]]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L72-L74)

Return a manifest of which virtual register values this node needs to read from.

### removes

`removes() → set[str]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L90-L96)

Return a manifest of virtual registers that this node removes.

It is assumed that registers are removed as a last step; it is not ill-defined to read and write from a removed register.

### validate\_and\_update

`validate_and_update(register_descriptions: dict[str, tuple[int, VirtualType]])`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L122-L160)

Validate provided register descriptions are compatible, update with changes.

This method can be used by a samplex to determine when a node execution order has well-defined dependencies before sampling begins.

**Parameters**

**register\_descriptions** – A map from existing register names to their size and type.

### writes\_to

`writes_to() → dict[str, tuple[set[int], VirtualType]]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/samplex/nodes/node.py#L76-L78)

Return a manifest of which virtual register values this node needs to write to.
