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

Create new instance with id

return reference to what the AdjContainer contains

return mut reference to what the AdjContainer contains

returns iterator over indices of neighbors

count number of neighbors, i.e. number of edges incident to self

returns id of container

returns Some(first element from the adjecency List) or None

check if vertex with other_id is adjacent to self

Note:

(in Graph<T>: id equals the index corresponding to self)

Sorting adjacency lists

shuffle adjacency list

Implementors