Dependency graph and incremental recalculation
The engine keeps a directed graph that records which cells each formula depends on. When a value changes, only its transitive dependents are recalculated, in topological order. A visual debug overlay flashes recalculated cells, which shows that recalculation is incremental rather than a full sheet rebuild.
Planned. This page shows the specification from issue #192. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A 1,000-row order grid with a per-row Total formula and a grand-total row. A recalculation counter is displayed.
Expected behavior
Editing Qty in row 5 flashes only row 5's Total and the grand total, and the counter shows 2. A full recalc flashes every formula cell. The trace arrows show the precedent and dependent chains.
Planned API surface
method: formulaEngine.getDependents(address)method: formulaEngine.getPrecedents(address)method: api.recalculate({full})event: recalculated (changedCells)option: formulas.debugFlashRecalcAcceptance criteria
- The recalculated set equals the transitive dependents of the changed cells (verified in tests). (pending)
- Each cell is evaluated at most once per recalculation pass. (pending)
- The recalculated event lists exactly the changed addresses. (pending)
- Recalculation preserves topological order, so no cell reads a stale value. (pending)
- Changing a cell that has no dependents triggers zero evaluations. (pending)