Trait structures::map::traversable::TraversableCollection
source · pub trait TraversableCollection<K, V>: MapCollection<K, V> + IntoTraverser<K>{
type EdgeType;
// Required methods
fn degree_of(&self, key: K) -> isize;
fn diameter(&self) -> f32;
fn edge_list(&self) -> Vec<Self::EdgeType>;
fn edges(&self) -> usize;
fn has_cycle(&self) -> bool;
fn is_bipartite(&self) -> bool;
fn is_connected(&self) -> bool;
fn is_neighbor(&self, key_a: K, key_b: K) -> bool;
fn path_of(
&mut self,
key_a: K,
key_b: K
) -> Option<DoublyLinkedList<KeyValue<usize, V>>>;
}Required Associated Types§
Required Methods§
sourcefn degree_of(&self, key: K) -> isize
fn degree_of(&self, key: K) -> isize
Returns the degree of the ‘node’ with the specified key, or returns -1 if no such ‘node’ with that key exists. The degree of a ‘node’ is the number of ‘nodes’ it is connected to.
sourcefn diameter(&self) -> f32
fn diameter(&self) -> f32
Returns the diameter of the ‘traversable collection’. The diameter of a ‘traversable collection’ is the longest path from one ‘node’ to another ‘node’.
sourcefn edge_list(&self) -> Vec<Self::EdgeType>
fn edge_list(&self) -> Vec<Self::EdgeType>
Returns a list of the ‘edges’ in the ‘traversable collection’.
sourcefn has_cycle(&self) -> bool
fn has_cycle(&self) -> bool
Returns true if the ‘traversable collection’ has a cycle within it. A cycle is where ‘nodes’ are connected together in a circular path.
sourcefn is_bipartite(&self) -> bool
fn is_bipartite(&self) -> bool
Returns true if the ‘traversable collection’ is a bipartite ‘graph’. A bipartite ‘graph’ is a graph that can be divided into two disjoint sets with no ‘node’ in either set connected to a ‘node’ in the same set.
sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Returns true if every ‘node’ in the ‘traversable collection’ is connected to at least one other ‘node’.
sourcefn is_neighbor(&self, key_a: K, key_b: K) -> bool
fn is_neighbor(&self, key_a: K, key_b: K) -> bool
Returns true if the ‘node’ with the second specified key is a neighbor of the ‘node’ with the first specified key. If either key does not belong to an existing ‘node’, or the two ‘nodes’ are not neighbors, this returns false. A ‘node’ neighbor is a ‘node’ that is directly linked to the other ‘node’.
sourcefn path_of(
&mut self,
key_a: K,
key_b: K
) -> Option<DoublyLinkedList<KeyValue<usize, V>>>
fn path_of( &mut self, key_a: K, key_b: K ) -> Option<DoublyLinkedList<KeyValue<usize, V>>>
Returns a ‘doubly linked list’ containing the path from the first specified key to the second specified key. Returns None if there is no path. The path contains the key/value pairs of each ‘node’ in the path and is stored in order from key_a at the start to key_b at the end.