1 unstable release
new 0.1.0 | Jan 16, 2025 |
---|
#1569 in Data structures
10KB
209 lines
wolf-derivation-graph
By Wolf McNally
Status
A work in progress 🚧
Slender stem with fragile buds 🌱
Use at your own risk 🤷🏽♂️
Introduction
The wolf-derivation-graph
crate provides a graph variant for basic on-demand derivation of values from other values.
It affords constructing a DAG (Directed Acyclic Graph) of values where each value is either set directly on specific input nodes, or derived from one or more other nodes connected by edges.
A graph node can be queried to obtain a value, and the graph will automatically derive the value by recursively evaluating the dependencies. Derived values are memoized, so that once a value is derived, it is stored and reused for subsequent queries.
Changing a value on a node will invalidate the derived values of all nodes that depend on it, causing them to be recomputed the next time they are queried.
Documentation
Currently the best documentation is the unit tests.
Dependencies
~1–1.4MB
~30K SLoC