Inside GraphWorkflow: Kahn's algorithm, frozen plans, and runtime overhead near zero

KyeGomezB · x · 2026-09-08

GraphWorkflow compiles once and sweeps many times: at compile time it infers entry/exit points from node degrees, computes topological generations via Kahn's algorithm, builds predecessor/successor maps in a single edge-list pass, and freezes everything into a per-layer execution plan.

At runtime the graph backend (NetworkX or rustworkx, with Rust computing generations) is entirely out of the hot path — the loop just sweeps the frozen plan with a shared lazy thread pool, and singleton layers execute inline.

The same diamond workflow takes 20 lines vs 40 in LangGraph: no typed schemas, reducers, or explicit START/END wiring (50% less code).

Related event: Swargs Open-Sources GraphWorkflow, a Compile-Once Graph Execution Engine Up to 62.5x Faster Than LangGraph(10 posts)→

Original post →

More from coding & agent

coding & agent channel →