/** * Deterministic evaluation ordering with cycle detection over a *dirty subgraph*. * * Given the set of formula cells that must recompute and a function yielding, for * a cell, the dirty cells that depend on it, this computes a topological order * (precedents before dependents) via Kahn's algorithm. Any cells that cannot be * ordered are part of — or downstream of — a circular reference and are returned * separately so the caller can flag them `#CIRC!` rather than looping forever. * * Working over only the dirty subgraph (not the whole graph) is what keeps * recalculation proportional to the change, not the sheet size. * * @packageDocumentation */ import type { CellId } from '../types/formula.types'; /** The outcome of ordering a dirty subgraph. */ export interface CalculationOrder { /** Cells in a safe precedents-first evaluation order (acyclic part). */ readonly order: CellId[]; /** Cells that are in, or downstream of, a cycle (could not be ordered). */ readonly cyclic: Set; } /** * Computes a precedents-first evaluation order for `dirty`. * * @param dirty - The set of formula cells to order. * @param dependentsInDirty - Yields the members of `dirty` that directly depend * on the given cell (its out-edges within the subgraph). * @returns The acyclic {@link CalculationOrder.order} plus the {@link * CalculationOrder.cyclic} remainder. */ export declare function computeCalculationOrder(dirty: ReadonlySet, dependentsInDirty: (cell: CellId) => Iterable): CalculationOrder; //# sourceMappingURL=cycle-detector.d.ts.map