mixle.experimental.typed_runtime.graph module

Compiled update graph and dependency-aware invalidation operations.

class DependencyEdge(source_node, target_node, artifact=ArtifactKind.PARAMETERS, reason='child update invalidates parent computation')[source]

Bases: object

A source-node artifact whose change invalidates a dependent target.

Parameters:
  • source_node (str)

  • target_node (str)

  • artifact (ArtifactKind)

  • reason (str)

as_dict()[source]

Return a JSON-compatible representation.

Return type:

dict[str, str]

class UpdateGraph(nodes, edges, root_node, compiler_version=1)[source]

Bases: object

Directed acyclic graph of typed updates and invalidation dependencies.

Edges point from an updated source to a dependent computation. Consequently, invalidated_by(node) walks forward from that node toward ancestors and any other consumers of shared state.

Parameters:
  • nodes (tuple[UpdateNode, ...])

  • edges (tuple[DependencyEdge, ...])

  • root_node (str)

  • compiler_version (int)

node(node_id)[source]

Return a node by id.

Parameters:

node_id (str)

Return type:

UpdateNode

node_at(path)[source]

Return the first node compiled at path.

Parameters:

path (str)

Return type:

UpdateNode

dependents(node_id)[source]

Return direct computations invalidated by an update to node_id.

Parameters:

node_id (str)

Return type:

tuple[str, …]

invalidated_by(node_id, *, include_self=True)[source]

Return the transitive invalidation closure in dependency order.

Parameters:
  • node_id (str)

  • include_self (bool)

Return type:

tuple[str, …]

topological_order()[source]

Return child-before-dependent order, raising on a dependency cycle.

Return type:

tuple[str, …]

as_dict()[source]

Return a JSON-compatible graph without runtime object references.

Return type:

dict[str, Any]

property compute_band

float32 only when every node’s subtree qualifies.

Type:

Tree-level precision eligibility

property convergence_certificate

the weakest node certificate (guarantees compose by minimum).

Type:

Tree-level guarantee

explain()[source]

Render a compact human-readable execution-plan explanation.

Return type:

str

classmethod from_parts(nodes, edges, *, root_node)[source]

Build and validate an immutable graph from iterables.

Parameters:
Return type:

UpdateGraph

exception UpdateGraphError[source]

Bases: ValueError

Raised when a compiled update graph violates structural invariants.

class UpdateNode(node_id, path, model_type, estimator_type, contract, cost, parameter_count, model=None, estimator=None)[source]

Bases: object

One independently inspectable and potentially schedulable model node.

Parameters:
  • node_id (str)

  • path (str)

  • model_type (str)

  • estimator_type (str | None)

  • contract (UpdateContract)

  • cost (CostEstimate)

  • parameter_count (int)

  • model (Any)

  • estimator (Any)

as_dict()[source]

Return metadata without runtime model or estimator objects.

Return type:

dict[str, Any]