pub struct CausaloidGraph<T: Clone> { /* private fields */ }Expand description
A specialized graph structure for representing and reasoning about causal relationships.
CausaloidGraph is a wrapper around an ultragraph graph, tailored for holding
nodes that implement the Causable trait. This structure allows for modeling
complex, non-linear causal systems where the activation of one cause can influence
others in a directed, potentially acyclic, manner.
The graph uses an adjacency matrix for its underlying storage, which provides fast edge lookups but can be memory-intensive if the graph is sparse and has a large capacity.
§Type Parameters
T: The type of the nodes in the graph. It must implementCausableto allow for causal reasoning,PartialEqfor node comparison,Cloneto manage graph data, andDisplayfor explanations. A commonTis theCausaloidstruct.
Implementations§
Source§impl<T: Clone> CausaloidGraph<T>
impl<T: Clone> CausaloidGraph<T>
Sourcepub fn new(id: IdentificationValue) -> Self
pub fn new(id: IdentificationValue) -> Self
Creates a new CausaloidGraph with a default capacity.
This constructor initializes the graph with a default capacity of 500 nodes. It utilizes an adjacency matrix for storage, which is suitable for dense graphs or graphs where the maximum number of nodes is known and not excessively large.
§Returns
Sourcepub fn new_with_capacity(id: IdentificationValue, capacity: usize) -> Self
pub fn new_with_capacity(id: IdentificationValue, capacity: usize) -> Self
Creates a new CausaloidGraph with a specified capacity.
This constructor allows you to pre-allocate space for a given number of nodes, which can be beneficial for performance if the approximate size of the graph is known beforehand. The underlying storage uses an adjacency matrix.
§Arguments
capacity- The maximum number of nodes the graph is expected to hold.
Trait Implementations§
Source§impl<I, O, PS, C> CausableGraph<Causaloid<I, O, PS, C>> for CausaloidGraph<Causaloid<I, O, PS, C>>
impl<I, O, PS, C> CausableGraph<Causaloid<I, O, PS, C>> for CausaloidGraph<Causaloid<I, O, PS, C>>
fn is_frozen(&self) -> bool
Source§fn freeze(&mut self)
fn freeze(&mut self)
Static state. Read moreSource§fn get_graph(&self) -> &UltraGraphWeighted<Causaloid<I, O, PS, C>, u64>
fn get_graph(&self) -> &UltraGraphWeighted<Causaloid<I, O, PS, C>, u64>
CausalGraph. Read moreSource§fn add_root_causaloid(
&mut self,
value: Causaloid<I, O, PS, C>,
) -> Result<usize, CausalityGraphError>
fn add_root_causaloid( &mut self, value: Causaloid<I, O, PS, C>, ) -> Result<usize, CausalityGraphError>
Source§fn contains_root_causaloid(&self) -> bool
fn contains_root_causaloid(&self) -> bool
Source§fn get_root_causaloid(&self) -> Option<&Causaloid<I, O, PS, C>>
fn get_root_causaloid(&self) -> Option<&Causaloid<I, O, PS, C>>
Source§fn get_root_index(&self) -> Option<usize>
fn get_root_index(&self) -> Option<usize>
Source§fn get_last_index(&self) -> Result<usize, CausalityGraphError>
fn get_last_index(&self) -> Result<usize, CausalityGraphError>
Source§fn add_causaloid(
&mut self,
value: Causaloid<I, O, PS, C>,
) -> Result<usize, CausalityGraphError>
fn add_causaloid( &mut self, value: Causaloid<I, O, PS, C>, ) -> Result<usize, CausalityGraphError>
Source§fn contains_causaloid(&self, index: usize) -> bool
fn contains_causaloid(&self, index: usize) -> bool
Source§fn get_causaloid(&self, index: usize) -> Option<&Causaloid<I, O, PS, C>>
fn get_causaloid(&self, index: usize) -> Option<&Causaloid<I, O, PS, C>>
Source§fn remove_causaloid(
&mut self,
index: usize,
) -> Result<(), CausalGraphIndexError>
fn remove_causaloid( &mut self, index: usize, ) -> Result<(), CausalGraphIndexError>
Source§fn add_edge(&mut self, a: usize, b: usize) -> Result<(), CausalGraphIndexError>
fn add_edge(&mut self, a: usize, b: usize) -> Result<(), CausalGraphIndexError>
Source§fn add_edg_with_weight(
&mut self,
a: usize,
b: usize,
weight: u64,
) -> Result<(), CausalGraphIndexError>
fn add_edg_with_weight( &mut self, a: usize, b: usize, weight: u64, ) -> Result<(), CausalGraphIndexError>
Source§fn remove_edge(
&mut self,
a: usize,
b: usize,
) -> Result<(), CausalGraphIndexError>
fn remove_edge( &mut self, a: usize, b: usize, ) -> Result<(), CausalGraphIndexError>
Source§fn size(&self) -> usize
fn size(&self) -> usize
Source§fn number_edges(&self) -> usize
fn number_edges(&self) -> usize
Source§fn number_nodes(&self) -> usize
fn number_nodes(&self) -> usize
Source§fn freeze_dag(&mut self) -> Result<(), CausalityGraphError>
fn freeze_dag(&mut self) -> Result<(), CausalityGraphError>
Source§fn freeze_verified(
&mut self,
state_writers: &[usize],
) -> Result<(), CausalityGraphError>where
Self: Sized,
fn freeze_verified(
&mut self,
state_writers: &[usize],
) -> Result<(), CausalityGraphError>where
Self: Sized,
freeze_dag) plus the single-writer invariant at reconvergent
joins — the structural preconditions the schedule-invariance theorem
(core.causaloid.graph_fold_order_invariant) assumes. Read moreSource§fn freeze_verified_with_check<F>(
&mut self,
state_writers: &[usize],
level_check: F,
) -> Result<(), CausalityGraphError>
fn freeze_verified_with_check<F>( &mut self, state_writers: &[usize], level_check: F, ) -> Result<(), CausalityGraphError>
freeze_verified with a level-specific hook — the extension
point for stack-level structural checks (e.g. the quantum layer’s commuting-factorization
check; the QCM-on-EPP freeze model). The hook runs after the built-in checks pass, on the
frozen graph; a hook error rolls the graph back to the dynamic state.Source§fn check_single_writer(
&self,
state_writers: &[usize],
) -> Result<(), CausalityGraphError>
fn check_single_writer( &self, state_writers: &[usize], ) -> Result<(), CausalityGraphError>
freeze_verified). Split out so hooks and tests can run it
directly.Source§fn get_shortest_path(
&self,
start_index: usize,
stop_index: usize,
) -> Result<Vec<usize>, CausalityGraphError>
fn get_shortest_path( &self, start_index: usize, stop_index: usize, ) -> Result<Vec<usize>, CausalityGraphError>
Source§impl<T: Clone + Clone> Clone for CausaloidGraph<T>
impl<T: Clone + Clone> Clone for CausaloidGraph<T>
Source§fn clone(&self) -> CausaloidGraph<T>
fn clone(&self) -> CausaloidGraph<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for CausaloidGraph<CausaloidId>
impl Default for CausaloidGraph<CausaloidId>
Source§impl Identifiable for CausaloidGraph<CausaloidId>
impl Identifiable for CausaloidGraph<CausaloidId>
Source§impl<V, PS, C> MonadicCausableGraphReasoning<V, PS, C> for CausaloidGraph<Causaloid<V, V, PS, C>>
impl<V, PS, C> MonadicCausableGraphReasoning<V, PS, C> for CausaloidGraph<Causaloid<V, V, PS, C>>
Source§fn evaluate_single_cause(
&self,
index: usize,
effect: &PropagatingEffect<V>,
) -> PropagatingEffect<V>
fn evaluate_single_cause( &self, index: usize, effect: &PropagatingEffect<V>, ) -> PropagatingEffect<V>
Source§fn evaluate_subgraph_from_cause(
&self,
start_index: usize,
initial_effect: &PropagatingEffect<V>,
) -> PropagatingEffect<V>
fn evaluate_subgraph_from_cause( &self, start_index: usize, initial_effect: &PropagatingEffect<V>, ) -> PropagatingEffect<V>
Source§fn evaluate_subgraph_from_cause_with_lambda_edges(
&self,
start_index: usize,
initial_effect: &PropagatingEffect<V>,
lambda_edges: &LambdaEdges<V>,
) -> PropagatingEffect<V>
fn evaluate_subgraph_from_cause_with_lambda_edges( &self, start_index: usize, initial_effect: &PropagatingEffect<V>, lambda_edges: &LambdaEdges<V>, ) -> PropagatingEffect<V>
evaluate_subgraph_from_cause with per-edge Λ
decoration slots: the value flowing along a decorated edge is transformed by that edge’s Λ
(keyed by intrinsic (source, target) identity, never by order; absent slot = identity)
before any join, so a reconvergent join computes ∇(Λ₁(a), Λ₂(b)) — Hardy’s connection
data on the edges, the commutative fuse at the node (core.causaloid.inversion,
core.causaloid.graph_fold_order_invariant). Read moreSource§fn evaluate_shortest_path_between_causes(
&self,
start_index: usize,
stop_index: usize,
initial_effect: &PropagatingEffect<V>,
) -> PropagatingEffect<V>
fn evaluate_shortest_path_between_causes( &self, start_index: usize, stop_index: usize, initial_effect: &PropagatingEffect<V>, ) -> PropagatingEffect<V>
Source§impl<V, S, C> StatefulMonadicCausableGraphReasoning<V, S, C> for CausaloidGraph<Causaloid<V, V, S, C>>
impl<V, S, C> StatefulMonadicCausableGraphReasoning<V, S, C> for CausaloidGraph<Causaloid<V, V, S, C>>
Source§fn evaluate_single_cause_stateful(
&self,
index: usize,
effect: &PropagatingProcess<V, S, C>,
) -> PropagatingProcess<V, S, C>
fn evaluate_single_cause_stateful( &self, index: usize, effect: &PropagatingProcess<V, S, C>, ) -> PropagatingProcess<V, S, C>
crate::MonadicCausableGraphReasoning::evaluate_single_cause.Source§fn evaluate_subgraph_from_cause_stateful(
&self,
start_index: usize,
initial_effect: &PropagatingProcess<V, S, C>,
) -> PropagatingProcess<V, S, C>
fn evaluate_subgraph_from_cause_stateful( &self, start_index: usize, initial_effect: &PropagatingProcess<V, S, C>, ) -> PropagatingProcess<V, S, C>
crate::MonadicCausableGraphReasoning::evaluate_subgraph_from_cause.Source§fn evaluate_shortest_path_between_causes_stateful(
&self,
start_index: usize,
stop_index: usize,
initial_effect: &PropagatingProcess<V, S, C>,
) -> PropagatingProcess<V, S, C>
fn evaluate_shortest_path_between_causes_stateful( &self, start_index: usize, stop_index: usize, initial_effect: &PropagatingProcess<V, S, C>, ) -> PropagatingProcess<V, S, C>
crate::MonadicCausableGraphReasoning::evaluate_shortest_path_between_causes.