Struct deep_causality::types::context_types::context_graph::Context
source · pub struct Context<'l, D, S, T, ST, V>where
D: Datable,
S: Spatial<V>,
T: Temporable<V>,
ST: SpaceTemporal<V>,
V: Default + Copy + Clone + Hash + Eq + PartialEq + Add<V, Output = V> + Sub<V, Output = V> + Mul<V, Output = V>,{ /* private fields */ }
Implementations§
Trait Implementations§
source§impl<'l, D, S, T, ST, V> ContextuableGraph<'l, D, S, T, ST, V> for Context<'l, D, S, T, ST, V>
impl<'l, D, S, T, ST, V> ContextuableGraph<'l, D, S, T, ST, V> for Context<'l, D, S, T, ST, V>
source§fn add_node(&mut self, value: Contextoid<D, S, T, ST, V>) -> usize
fn add_node(&mut self, value: Contextoid<D, S, T, ST, V>) -> usize
Ads a new Contextoid to the context. You can add the same contextoid multiple times, but each one will return a new and unique node index.
source§fn contains_node(&self, index: usize) -> bool
fn contains_node(&self, index: usize) -> bool
Returns only true if the context contains the contextoid with the given index.
source§fn get_node(&self, index: usize) -> Option<&Contextoid<D, S, T, ST, V>>
fn get_node(&self, index: usize) -> Option<&Contextoid<D, S, T, ST, V>>
Returns a reference to the contextoid with the given index. If the context does not contain the contextoid, it will return None.
source§fn remove_node(&mut self, index: usize) -> Result<(), ContextIndexError>
fn remove_node(&mut self, index: usize) -> Result<(), ContextIndexError>
Removes a contextoid from the context. Returns ContextIndexError if the index is not found
source§fn add_edge(
&mut self,
a: usize,
b: usize,
weight: RelationKind
) -> Result<(), ContextIndexError>
fn add_edge( &mut self, a: usize, b: usize, weight: RelationKind ) -> Result<(), ContextIndexError>
Adds a new weighted edge between two nodes. Returns either Ok after success, or ContextIndexError if any of the nodes are not in the context.
source§fn contains_edge(&self, a: usize, b: usize) -> bool
fn contains_edge(&self, a: usize, b: usize) -> bool
Returns only true if the context contains the edge between the two nodes. If the context does not contain the edge or any of the nodes it will return false. You may want to call contains_node first to ascertain that the nodes are in the context.
source§fn remove_edge(&mut self, a: usize, b: usize) -> Result<(), ContextIndexError>
fn remove_edge(&mut self, a: usize, b: usize) -> Result<(), ContextIndexError>
Removes an edge between two nodes. Returns either Ok after success, or ContextIndexError if any of the nodes are not in the context.
source§fn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the number of nodes in the context.
source§fn edge_count(&self) -> usize
fn edge_count(&self) -> usize
Returns the number of edges in the context.