CausalGraph

Struct CausalGraph 

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

Causal graph tracking antecedent relationships

Implementations§

Source§

impl CausalGraph

Source

pub fn new() -> Self

Create new causal graph

Source

pub fn add_edge(&self, cause: PatternId, effect: PatternId)

Add causal edge: cause -> effect

Source

pub fn add_pattern(&self, id: PatternId, timestamp: SubstrateTime)

Add pattern with timestamp

Source

pub fn causes(&self, pattern: PatternId) -> Vec<PatternId>

Get direct causes of a pattern

Source

pub fn effects(&self, pattern: PatternId) -> Vec<PatternId>

Get direct effects of a pattern

Source

pub fn out_degree(&self, pattern: PatternId) -> usize

Get out-degree (number of effects)

Source

pub fn in_degree(&self, pattern: PatternId) -> usize

Get in-degree (number of causes)

Source

pub fn distance(&self, from: PatternId, to: PatternId) -> Option<usize>

Compute shortest path distance between two patterns

Source

pub fn causal_past(&self, pattern: PatternId) -> Vec<PatternId>

Get all patterns in causal past

Source

pub fn causal_future(&self, pattern: PatternId) -> Vec<PatternId>

Get all patterns in causal future

Source

pub fn filter_by_light_cone( &self, reference: PatternId, reference_time: SubstrateTime, cone_type: CausalConeType, candidates: &[PatternId], ) -> Vec<PatternId>

Filter patterns by light cone constraint

Source

pub fn stats(&self) -> CausalGraphStats

Get statistics about the causal graph

Trait Implementations§

Source§

impl Default for CausalGraph

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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.