/** * Pure graph utilities over adjacency maps keyed by cell key. The adapter * owns the maps; these functions are generic so they stay trivially testable. * Implementations are iterative (explicit queues) — dependency chains * thousands of cells deep must not overflow the JS stack. */ /** * Transitive closure of `dirty` over the reverse-dependency edges: * everything that must be recomputed. Includes the dirty cells themselves. */ export declare function collectAffectedCells(dirty: Iterable, getDependents: (key: K) => Iterable | undefined): Set; export interface FormulaRecomputeOrder { /** * A valid evaluation order: every cell appears after all of its * dependencies that are part of the affected set. */ order: K[]; /** * Cells on a cycle, or locked downstream of one — Kahn's algorithm never * peels them. The adapter marks all of them `#CYCLE!`. */ cyclic: Set; } /** * Single-pass Kahn's algorithm over the affected subgraph; doubles as cycle * detection. `getDependencies` should yield formula-cell dependencies only * (raw cells are sinks and never expand); edges to cells outside `affected` * are ignored — their values are already final. */ export declare function orderForRecompute(affected: Set, getDependencies: (key: K) => Iterable | undefined): FormulaRecomputeOrder;