pub struct TemporalDag { /* private fields */ }Expand description
Directed acyclic graph over lagged (VariableId, Lag) nodes.
Implementations§
Source§impl TemporalDag
impl TemporalDag
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Node count.
Sourcepub fn add_node(&mut self, node: NodeRef) -> Result<DenseNodeId, GraphError>
pub fn add_node(&mut self, node: NodeRef) -> Result<DenseNodeId, GraphError>
Sourcepub fn add_lagged(
&mut self,
variable: VariableId,
lag: Lag,
) -> Result<DenseNodeId, GraphError>
pub fn add_lagged( &mut self, variable: VariableId, lag: Lag, ) -> Result<DenseNodeId, GraphError>
Sourcepub fn insert_directed(
&mut self,
from: DenseNodeId,
to: DenseNodeId,
) -> Result<(), GraphError>
pub fn insert_directed( &mut self, from: DenseNodeId, to: DenseNodeId, ) -> Result<(), GraphError>
Insert directed edge with temporal rules.
Contemporaneous self-edges are rejected. A self-loop on a single dense
node is always a GraphError::Cycle; lagged self-influence is modeled
as an edge between two distinct nodes (e.g. X@t-1 -> X@t).
from’s lag must be greater than or equal to to’s lag: larger Lag
values sit further in the past (Lag::CONTEMPORANEOUS is the present),
so an edge is only valid running from the past (or same time) toward the
present. An edge whose source is nearer the present than its target
would point from the future into the past and is rejected.
§Errors
Unknown nodes, duplicates, cycles, contemporaneous self-edges, or edges that point from the future into the past.
Sourcepub fn children(&self, id: DenseNodeId) -> &[DenseNodeId]
pub fn children(&self, id: DenseNodeId) -> &[DenseNodeId]
Children.
Sourcepub fn edges(&self) -> impl Iterator<Item = MarkedEdge> + '_
pub fn edges(&self) -> impl Iterator<Item = MarkedEdge> + '_
Iterate directed edges as marked edges.
Sourcepub fn reaches(&self, from: DenseNodeId, to: DenseNodeId) -> bool
pub fn reaches(&self, from: DenseNodeId, to: DenseNodeId) -> bool
Reachability.
Sourcepub fn reaches_with(
&self,
from: DenseNodeId,
to: DenseNodeId,
ws: &mut GraphWorkspace,
) -> bool
pub fn reaches_with( &self, from: DenseNodeId, to: DenseNodeId, ws: &mut GraphWorkspace, ) -> bool
Reachability with a reusable workspace.
Sourcepub fn temporal_key(&self, id: DenseNodeId) -> Option<TemporalNodeKey>
pub fn temporal_key(&self, id: DenseNodeId) -> Option<TemporalNodeKey>
Map dense id to a serializable TemporalNodeKey.
Source§impl TemporalDag
impl TemporalDag
Sourcepub fn unfold_lazy(
&self,
indexer: TemporalIndexer,
) -> Result<LazyUnfoldedTemporalGraph, GraphError>
pub fn unfold_lazy( &self, indexer: TemporalIndexer, ) -> Result<LazyUnfoldedTemporalGraph, GraphError>
Sourcepub fn unfold(
&self,
indexer: TemporalIndexer,
) -> Result<UnfoldedTemporalGraph, GraphError>
pub fn unfold( &self, indexer: TemporalIndexer, ) -> Result<UnfoldedTemporalGraph, GraphError>
Trait Implementations§
Source§impl Clone for TemporalDag
impl Clone for TemporalDag
Source§fn clone(&self) -> TemporalDag
fn clone(&self) -> TemporalDag
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more