nodekit.Graph
pydantic-model
¶
Fields:
-
type(Literal['Graph']) -
nodekit_version(str) -
nodes(dict[NodeId, Annotated[Node | Graph, Field(discriminator='type')]]) -
transitions(dict[NodeId, Transition]) -
start(NodeId) -
registers(dict[RegisterId, LeafValue]) -
annotation(JsonValue)
Validators:
-
validate_nodekit_version→nodekit_version -
check_graph_is_valid
annotation
pydantic-field
¶
An optional, user-defined annotation for the Graph that may be useful for debugging or analysis purposes.
nodes
pydantic-field
¶
The set of Nodes in the Graph, by NodeId. Note that a Graph can contain other Graphs as Nodes.
transitions
pydantic-field
¶
The set of Transitions in the Graph, by NodeId.
get_node_at
¶
Return the Node or nested Graph at a NodeAddress.
Parameters:
-
node_address(NodeAddress) –The address to resolve from this Graph.
Returns:
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.