Cyclium.Workflow.DAG (Cyclium v0.1.13)

Copy Markdown View Source

Shared DAG validation for workflow step dependencies.

Used by both the compile-time Workflow DSL and the runtime DynamicWorkflow.Loader to detect circular dependencies.

Summary

Functions

Topological sort of a DAG. Returns {:ok, ordered_list} or {:error, cycle_node}.

Validates that a set of steps forms a valid DAG (no circular dependencies).

Validates step references: all depends_on entries must reference existing step IDs.

Functions

topo_sort(adj, nodes)

Topological sort of a DAG. Returns {:ok, ordered_list} or {:error, cycle_node}.

validate!(adjacency)

Validates that a set of steps forms a valid DAG (no circular dependencies).

Accepts a map of %{step_id => [dependency_ids]}. Returns :ok or raises with the cycle node.

validate_references!(adjacency)

Validates step references: all depends_on entries must reference existing step IDs.