Skip to content

nodekit.Graph pydantic-model

Fields:

Validators:

  • validate_nodekit_versionnodekit_version
  • check_graph_is_valid

annotation pydantic-field

annotation: JsonValue = None

An optional, user-defined annotation for the Graph that may be useful for debugging or analysis purposes.

nodes pydantic-field

nodes: dict[
    NodeId,
    Annotated[Node | Graph, Field(discriminator="type")],
]

The set of Nodes in the Graph, by NodeId. Note that a Graph can contain other Graphs as Nodes.

registers pydantic-field

registers: dict[RegisterId, LeafValue]

The initial register values.

start pydantic-field

start: NodeId

The start Node of the Graph.

transitions pydantic-field

transitions: dict[NodeId, Transition]

The set of Transitions in the Graph, by NodeId.

get_node_at

get_node_at(node_address: NodeAddress) -> Node | Graph

Return the Node or nested Graph at a NodeAddress.

Parameters:

  • node_address (NodeAddress) –

    The address to resolve from this Graph.

Returns:

  • Node | Graph

    The Node or nested Graph at the given address.

Raises:

  • ValueError

    If the NodeAddress is empty, or if the NodeAddress tries to descend through a Node instead of a nested Graph.

  • KeyError

    If any NodeId in the NodeAddress does not exist.