Skip to main content

execution_plan

Function execution_plan 

Source
pub fn execution_plan(graph: &Graph, roots: &[NodeId]) -> Vec<NodeId>
Expand description

Build an execution plan that respects both data-flow edges (via topo_order_multi) and ordering edges (via derive_ordering). Returns a Vec<NodeId> in an order the executor can walk linearly, evaluating each node’s dependencies before it.

Fast path: when the graph has no destructive ops, this returns the same order topo_order_multi does — no extra cost beyond the analysis pass.

Cycle detection: if the combined (data + ordering) graph has a cycle — the residency rule emitted a destructive op that transitively depends on itself — this panics with a clear error message. That panic indicates a bug in the rule that emitted the destructive op, not user code.

Stability: among nodes that are concurrently ready, this picks the one whose topo_order_multi index is smallest. Result: when there are no ordering edges, the output matches topo_order_multi exactly.