nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
nk::DependencyGraph Class Reference

Dependency DAG over statement indices. More...

#include <dependency_graph.hpp>

Public Member Functions

 DependencyGraph (std::vector< StatementFacts > facts)
 Build from facts.
std::vector< size_t > dirtySetFor (const std::string &var) const
 Indices that must re-run when var is assigned externally.
std::vector< size_t > dirtySetFor (const std::string &var, const std::set< std::string > &externalDefs) const
 With the set of EXTERNALLY-DEFINED params (ReactiveSession): the wildcard-prefix rule additionally skips the pure defs of EVERY param in the set (a prefix re-run must not clobber other sliders' values back to script defaults).
std::vector< size_t > dirtySetForElement (const std::string &var, size_t r, size_t c) const
 Element-level variant: external write of ONE CELL (the table editor's setParamElement).
std::vector< size_t > dirtySetForElement (const std::string &var, size_t r, size_t c, const std::set< std::string > &externalDefs) const
const std::vector< StatementFacts > & facts () const
size_t size () const
const std::vector< size_t > & downstreamOf (size_t i) const
 Direct dependents of statement i (edges i → j).

Detailed Description

Dependency DAG over statement indices.

Edge i → j means "j must re-run when i re-runs" (j reads the nearest def i provides, or j is a wildcard reading everything, or i is a wildcard and j follows it).

Definition at line 84 of file dependency_graph.hpp.

Constructor & Destructor Documentation

◆ DependencyGraph()

nk::DependencyGraph::DependencyGraph ( std::vector< StatementFacts > facts)
explicit

Build from facts.

Nearest-definition edges for reads; wildcard statements depend on all prior statements AND every later statement depends on them.

Member Function Documentation

◆ dirtySetFor()

std::vector< size_t > nk::DependencyGraph::dirtySetFor ( const std::string & var) const

Indices that must re-run when var is assigned externally.

A PURE DEFINITION of var (var = literal — writes, never reads) is SKIPPED: setParam replaces it (re-running would reset the slider). Affected = readers + merge-writers + wildcard statements that may invisibly write var + transitive closure.

◆ dirtySetForElement()

std::vector< size_t > nk::DependencyGraph::dirtySetForElement ( const std::string & var,
size_t r,
size_t c ) const

Element-level variant: external write of ONE CELL (the table editor's setParamElement).

Affected = statements whose READ regions touch (r,c) on var + wildcards + statements that merge-write var while also reading it + transitive closure. Statements that only WRITE regions of var (definitions of other cells) stay clean — their inputs did not change.

◆ downstreamOf()

const std::vector< size_t > & nk::DependencyGraph::downstreamOf ( size_t i) const
inline

Direct dependents of statement i (edges i → j).

Const accessor for cycle detection / debug tooling.

Definition at line 123 of file dependency_graph.hpp.

◆ facts()

const std::vector< StatementFacts > & nk::DependencyGraph::facts ( ) const
inline

Definition at line 119 of file dependency_graph.hpp.

◆ size()

size_t nk::DependencyGraph::size ( ) const
inline

Definition at line 120 of file dependency_graph.hpp.


The documentation for this class was generated from the following file: