pub trait ContextuableGraph<D, S, T, ST>{
Show 13 methods
// Required methods
fn add_node(
&mut self,
value: Contextoid<D, S, T, ST>,
) -> Result<usize, ContextIndexError>;
fn contains_node(&self, index: usize) -> bool;
fn get_node(&self, index: usize) -> Option<&Contextoid<D, S, T, ST>>;
fn remove_node(
&mut self,
node_id: ContextoidId,
) -> Result<(), ContextIndexError>;
fn update_node(
&mut self,
node_id: ContextoidId,
new_node: Contextoid<D, S, T, ST>,
) -> Result<(), ContextIndexError>;
fn add_edge(
&mut self,
a: usize,
b: usize,
weight: RelationKind,
) -> Result<(), ContextIndexError>;
fn contains_edge(&self, a: usize, b: usize) -> bool;
fn get_edge(&self, a: usize, b: usize) -> Option<&RelationKind>;
fn remove_edge(
&mut self,
a: usize,
b: usize,
) -> Result<(), ContextIndexError>;
fn size(&self) -> usize;
fn is_empty(&self) -> bool;
fn number_of_nodes(&self) -> usize;
fn number_of_edges(&self) -> usize;
}Expand description
Trait for graph containing context-aware nodes.
D: Datable trait object S: Spatial trait object T: Temporable trait object ST: SpaceTemporal trait object V: Numeric type for dimension values
Provides methods for:
- Adding/removing nodes and edges
- Checking if nodes/edges exist
- Getting node references
- Getting graph size and counts
Nodes are Contextoid objects implementing required traits. Edges have a relation kind weight.
Methods return Result or Option types for error handling.
Required Methods§
fn add_node( &mut self, value: Contextoid<D, S, T, ST>, ) -> Result<usize, ContextIndexError>
fn contains_node(&self, index: usize) -> bool
fn get_node(&self, index: usize) -> Option<&Contextoid<D, S, T, ST>>
fn remove_node( &mut self, node_id: ContextoidId, ) -> Result<(), ContextIndexError>
fn update_node( &mut self, node_id: ContextoidId, new_node: Contextoid<D, S, T, ST>, ) -> Result<(), ContextIndexError>
fn add_edge( &mut self, a: usize, b: usize, weight: RelationKind, ) -> Result<(), ContextIndexError>
fn contains_edge(&self, a: usize, b: usize) -> bool
Sourcefn get_edge(&self, a: usize, b: usize) -> Option<&RelationKind>
fn get_edge(&self, a: usize, b: usize) -> Option<&RelationKind>
Returns the relation the edge from a to b carries, or None when no such edge
exists. This is the read counterpart of add_edge: without it the relation a caller
supplies is not recoverable from the context.
fn remove_edge(&mut self, a: usize, b: usize) -> Result<(), ContextIndexError>
fn size(&self) -> usize
fn is_empty(&self) -> bool
fn number_of_nodes(&self) -> usize
fn number_of_edges(&self) -> usize
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".