pub struct Dag { /* private fields */ }Expand description
A pure owned per-cell dependency graph.
dependencies[node] is the list of node keys node depends on. Build the
canonical sheet!addr keys with the shared cell_key helper in the CALLER
(workbook-compiler), then pass the finished strings here via
Dag::add_node/Dag::add_edge.
Implementations§
Source§impl Dag
impl Dag
Sourcepub fn add_node(&mut self, key: &str)
pub fn add_node(&mut self, key: &str)
Register a node (no-op if it already exists). A node with no edges is a zero-dependency node Kahn drains first.
Sourcepub fn add_edge(&mut self, from: &str, depends_on: &str)
pub fn add_edge(&mut self, from: &str, depends_on: &str)
Record that from DEPENDS ON depends_on. Both endpoints are registered
as nodes. Duplicate edges are not de-duplicated (the caller controls
edge multiplicity; the lighthouse never produces duplicate-edge cycles).
Sourcepub fn dependencies_of(&self, key: &str) -> &[String]
pub fn dependencies_of(&self, key: &str) -> &[String]
The cell keys key depends on (empty slice if key is unknown or has no
dependencies).
Sourcepub fn dependents(&self) -> HashMap<String, Vec<String>>
pub fn dependents(&self) -> HashMap<String, Vec<String>>
Derive the REVERSE adjacency (dependency → the nodes that depend on it).
This is the direction Kahn’s algorithm walks to decrement in-degree as it
drains zero-dependency nodes (finding #2). Every node appears as a key
(with an empty Vec when nothing depends on it).
Trait Implementations§
Source§impl JsonSchema for Dag
impl JsonSchema for Dag
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more