Skip to main content

DependencyGraph

Mutable workbook dependency graph.

Usage

Source

DependencyGraph()

Node identity is the canonical sheet-qualified cell address (CellKey). get_node(key) looks up that exact stored key.

get_dependencies / get_dependents / get_edge_attrs return endpoints exactly as stored. Topology is uint32 CSR+CSC after rebuild_adjacency; _edges / _reverse_edges are a mutation staging buffer and are empty once compact. Edge guards and provenance are nnz-parallel intern-id arrays beside CSR; _guards / _edge_provenance are the same kind of staging buffer and are empty once compact. Missing adjacency is empty (no per-node empty set()). resolve_endpoint / get_dependency_nodes resolve to stored cell keys when present (evaluation order, export, codegen). Rebuild drops non-node endpoints.

formula_shapes is an optional acceleration overlay from warm_formula_shapes (unset by default). Node.formula_ast is authoritative; eval and codegen fall back to AST when the overlay is missing. Compression, formula rewrite, and JSON/pickle load drop it (None). Callers who want shapes again must rewarm; a live FormulaEvaluator does not pick up a rewarm automatically.

Parameter Attributes

_nodes: dict[NodeKey, Node] = dict()
_edges: dict[NodeKey, set[NodeKey]] = dict()
_reverse_edges: dict[NodeKey, set[NodeKey]] = dict()
_staging: bool = True
_csr_keys: list[NodeKey] = list()
_node_index: dict[NodeKey, int] = dict()
_row_ptr: array.array[int] = _empty_uint32()
_col_idx: array.array[int] = _empty_uint32()
_col_ptr: array.array[int] = _empty_uint32()
_row_idx: array.array[int] = _empty_uint32()
_guard_id: array.array[int] = _empty_uint32()
_prov_id: array.array[int] = _empty_uint32()
_guard_exprs: list[GuardExpr | None] = _empty_guard_intern()
_provenances: list[EdgeProvenance | None] = _empty_prov_intern()
_guards: dict[EdgeKey, GuardExpr] = dict()
_edge_provenance: dict[EdgeKey, EdgeProvenance] = dict()
_hooks: list[NodeHook] = list()
leaf_classification: dict[str, str] | None = None
sheet_order: list[str] | None = None
sheet_bounds: dict[str, tuple[int, int]] | None = None
named_ranges: dict[str, tuple[str, str]] | None = None
named_range_ranges: dict[str, tuple[str, str, str]] | None = None
preparsed_formulas: dict[str, AstNode] | None = None
formula_shapes: FormulaShapeTable | None = None
cell_type_env: CellTypeEnv | None = None
domains: SeriesDomainIndex | None = None
_domains_handle: Any = None
_value_generation: int = 0