pub struct CausalGraph {
pub num_nodes: usize,
/* private fields */
}Expand description
Directed graph representing causal relationships
Fields§
§num_nodes: usizeNumber of nodes (event types)
Implementations§
Source§impl CausalGraph
impl CausalGraph
Sourcepub fn add_edge(
&mut self,
source: usize,
target: usize,
strength: f64,
relation: CausalRelation,
)
pub fn add_edge( &mut self, source: usize, target: usize, strength: f64, relation: CausalRelation, )
Add a causal edge
Sourcepub fn edges_from(&self, source: usize) -> &[(usize, f64, CausalRelation)]
pub fn edges_from(&self, source: usize) -> &[(usize, f64, CausalRelation)]
Get edges from a node
Sourcepub fn edges(&self) -> &[CausalEdge]
pub fn edges(&self) -> &[CausalEdge]
Get all edges
Sourcepub fn transitive_closure(&self) -> Self
pub fn transitive_closure(&self) -> Self
Compute transitive closure (indirect causation)
Uses Floyd-Warshall algorithm with O(n³) complexity. Limited to MAX_CLOSURE_NODES to prevent DoS.
Sourcepub fn reachable_from(&self, source: usize) -> HashSet<usize>
pub fn reachable_from(&self, source: usize) -> HashSet<usize>
Find nodes reachable from a source
Sourcepub fn to_undirected(&self) -> DynamicGraph
pub fn to_undirected(&self) -> DynamicGraph
Convert to undirected graph for mincut analysis
Trait Implementations§
Source§impl Clone for CausalGraph
impl Clone for CausalGraph
Source§fn clone(&self) -> CausalGraph
fn clone(&self) -> CausalGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CausalGraph
impl RefUnwindSafe for CausalGraph
impl Send for CausalGraph
impl Sync for CausalGraph
impl Unpin for CausalGraph
impl UnwindSafe for CausalGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more