Node#
- class hugr.hugr.node_port.Node(idx: int, _metadata: dict[str, object] = <factory>, _num_out_ports: int | None = None)[source]#
Bases:
ToNode
Node in hierarchical
Hugr
graph, with globally unique index.Methods
Generate an input port for this node.
Generate an output port for this node.
OutPort corresponding to this
Wire
.Returns an iterator over the output ports of this node.
Generate a port in direction for this node with offset.
Convert to a
Node
.Attributes
Metadata associated with this node.
idx
- inp(offset: int) InPort #
Generate an input port for this node.
- Parameters:
offset – port offset.
- Returns:
Incoming port for this node.
Examples
>>> Node(0).inp(1) InPort(Node(0), 1)
- out(offset: int) OutPort #
Generate an output port for this node.
- Parameters:
offset – port offset.
- Returns:
Outgoing port for this node.
Examples
>>> Node(0).out(1) OutPort(Node(0), 1)