Skip to main content

TemporalDag

Struct TemporalDag 

Source
pub struct TemporalDag { /* private fields */ }
Expand description

Directed acyclic graph over lagged (VariableId, Lag) nodes.

Implementations§

Source§

impl TemporalDag

Source

pub fn empty() -> Self

Empty temporal DAG.

Source

pub fn node_count(&self) -> usize

Node count.

Source

pub fn is_empty(&self) -> bool

Whether empty.

Source

pub fn nodes(&self) -> &[NodeRef]

Nodes in dense order.

Source

pub fn add_node(&mut self, node: NodeRef) -> Result<DenseNodeId, GraphError>

Add a lagged node.

§Errors

Non-lagged node refs or capacity overflow.

Source

pub fn add_lagged( &mut self, variable: VariableId, lag: Lag, ) -> Result<DenseNodeId, GraphError>

Convenience: add variable at lag.

§Errors

Capacity overflow.

Source

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.

Source

pub fn children(&self, id: DenseNodeId) -> &[DenseNodeId]

Children.

Source

pub fn edges(&self) -> impl Iterator<Item = MarkedEdge> + '_

Iterate directed edges as marked edges.

Source

pub fn reaches(&self, from: DenseNodeId, to: DenseNodeId) -> bool

Reachability.

Source

pub fn reaches_with( &self, from: DenseNodeId, to: DenseNodeId, ws: &mut GraphWorkspace, ) -> bool

Reachability with a reusable workspace.

Source

pub fn temporal_key(&self, id: DenseNodeId) -> Option<TemporalNodeKey>

Map dense id to a serializable TemporalNodeKey.

Source§

impl TemporalDag

Source

pub fn unfold_lazy( &self, indexer: TemporalIndexer, ) -> Result<LazyUnfoldedTemporalGraph, GraphError>

Lazy unfold over a finite indexer window .

§Errors

Unknown/non-lagged template nodes.

Source

pub fn unfold( &self, indexer: TemporalIndexer, ) -> Result<UnfoldedTemporalGraph, GraphError>

Eager unfold into a static Dag (materialises the full window).

§Errors

Unknown/non-lagged nodes, indexer issues, or cycle insertion.

Trait Implementations§

Source§

impl Clone for TemporalDag

Source§

fn clone(&self) -> TemporalDag

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TemporalDag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.