Trait net_ensembles::traits::AdjContainer
source · [−]pub trait AdjContainer<T> {
fn new(id: usize, node: T) -> Self;
fn contained(&self) -> &T;
fn contained_mut(&mut self) -> &mut T;
fn neighbors(&self) -> IterWrapper<'_>ⓘNotable traits for IterWrapper<'a>impl<'a> Iterator for IterWrapper<'a> type Item = &'a usize;
;
fn degree(&self) -> usize;
fn id(&self) -> usize;
fn get_adj_first(&self) -> Option<&usize>;
fn is_adjacent(&self, other_id: usize) -> bool;
fn sort_adj(&mut self);
fn shuffle_adj<R: Rng>(&mut self, rng: &mut R);
}
Expand description
Defines methods all adjecency containers should have
such that GenericGraph
can use it
Required Methods
sourcefn contained_mut(&mut self) -> &mut T
fn contained_mut(&mut self) -> &mut T
return mut reference to what the AdjContainer contains
sourcefn neighbors(&self) -> IterWrapper<'_>ⓘNotable traits for IterWrapper<'a>impl<'a> Iterator for IterWrapper<'a> type Item = &'a usize;
fn neighbors(&self) -> IterWrapper<'_>ⓘNotable traits for IterWrapper<'a>impl<'a> Iterator for IterWrapper<'a> type Item = &'a usize;
returns iterator over indices of neighbors
sourcefn get_adj_first(&self) -> Option<&usize>
fn get_adj_first(&self) -> Option<&usize>
returns Some(first element from the adjecency List)
or None
sourcefn is_adjacent(&self, other_id: usize) -> bool
fn is_adjacent(&self, other_id: usize) -> bool
check if vertex with other_id
is adjacent to self
Note:
(in Graph<T>
: id
equals the index corresponding to self
)
sourcefn shuffle_adj<R: Rng>(&mut self, rng: &mut R)
fn shuffle_adj<R: Rng>(&mut self, rng: &mut R)
shuffle adjacency list