[−][src]Trait net_ensembles::traits::AdjContainer
Defines methods all adjecency containers should have
such that GenericGraph
can use it
Required methods
fn new(id: usize, node: T) -> Self
Create new instance with id
fn contained(&self) -> &T
return reference to what the AdjContainer contains
fn contained_mut(&mut self) -> &mut T
return mut reference to what the AdjContainer contains
fn neighbors(&self) -> IterWrapper
returns iterator over indices of neighbors
fn degree(&self) -> usize
count number of neighbors, i.e. number of edges incident to self
fn id(&self) -> usize
returns id of container
fn get_adj_first(&self) -> Option<&usize>
returns Some(first element from the adjecency List)
or None
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
)
fn sort_adj(&mut self)
Sorting adjecency lists
Implementors
impl<T> AdjContainer<T> for SwContainer<T> where
T: Node + SerdeStateConform,
[src]
T: Node + SerdeStateConform,
fn new(id: usize, node: T) -> Self
[src]
Create new instance with id
fn contained(&self) -> &T
[src]
return reference to what the AdjContainer contains
fn contained_mut(&mut self) -> &mut T
[src]
return mut reference to what the AdjContainer contains
fn neighbors(&self) -> IterWrapper
[src]
returns iterator over indices of neighbors
fn degree(&self) -> usize
[src]
count number of neighbors, i.e. number of edges incident to self
fn id(&self) -> usize
[src]
returns id of container
fn get_adj_first(&self) -> Option<&usize>
[src]
returns Some(first element from the adjecency List)
or None
fn is_adjacent(&self, other_id: usize) -> bool
[src]
check if vertex with other_id
is adjacent to self
Note:
(in GenericGraph<T>
: id
equals the index corresponding to self
)
fn sort_adj(&mut self)
[src]
Sorting adjecency lists
- worst case:
O(edges log(edges))
impl<T: Node + SerdeStateConform> AdjContainer<T> for NodeContainer<T>
[src]
fn new(id: usize, node: T) -> Self
[src]
Create new instance with id
fn contained(&self) -> &T
[src]
return reference to what the NodeContainer contains
fn contained_mut(&mut self) -> &mut T
[src]
return mut reference to what the NodeContainer contains
fn neighbors(&self) -> IterWrapper
[src]
returns iterator over indices of neighbors
fn degree(&self) -> usize
[src]
count number of neighbors, i.e. number of edges incident to self
fn id(&self) -> usize
[src]
fn is_adjacent(&self, other_id: usize) -> bool
[src]
check if vertex with other_id
is adjacent to self
Note:
(in Graph<T>
: id
equals the index corresponding to self
)
fn sort_adj(&mut self)
[src]
Sorting adjecency lists
- calls
sort_unstable()
on all adjecency lists