pub trait DirectedGraph<T, E, K, V, W, C>where
K: Hash + Eq + Clone,
C: Hash + Eq + Clone,
W: Add + Sub + Eq + Ord + Copy,
T: Vertex<K, V>,
E: Edge<K, W, C>,{
// Required methods
fn adjacent(&self, from: &K, to: &K) -> bool;
fn neighbors(&self, from: &K) -> Vec<&K>;
fn leading_to(&self, to: &K) -> Vec<&K>;
fn get_all_keys(&self) -> Vec<&K>;
fn get_all_pairs(&self) -> Vec<(&K, &K)>;
fn get_vertex(&self, key: &K) -> Option<&T>;
fn get_mut_vertex(&mut self, key: &K) -> Option<&mut T>;
fn get_edge(&self, pair: (&K, &K)) -> Option<&E>;
fn get_mut_edge(&mut self, pair: (&K, &K)) -> Option<&mut E>;
}Expand description
This trait define the behaviour of a directed graph it requires the for vertexes (T), edges (E), vertex’s keys (K), vertex’s values (v), edge’s weights (W) and edge’s keys (C)
Required Methods§
Sourcefn adjacent(&self, from: &K, to: &K) -> bool
fn adjacent(&self, from: &K, to: &K) -> bool
This method returns a boolean stating if exist an edge from the first vertex to the other
Sourcefn neighbors(&self, from: &K) -> Vec<&K>
fn neighbors(&self, from: &K) -> Vec<&K>
This method returns a vector containing the keys of all the vertexes reached by edges starting from the argument
Sourcefn leading_to(&self, to: &K) -> Vec<&K>
fn leading_to(&self, to: &K) -> Vec<&K>
This method returns a vector containing the keys of all the vertexes with by edges leading to the argument
Sourcefn get_all_keys(&self) -> Vec<&K>
fn get_all_keys(&self) -> Vec<&K>
This method returns a vector containing references to the keys of all vertexes in the graph
Sourcefn get_all_pairs(&self) -> Vec<(&K, &K)>
fn get_all_pairs(&self) -> Vec<(&K, &K)>
This method returns a vector containing the pairs of all edges in the graph
fn get_vertex(&self, key: &K) -> Option<&T>
fn get_mut_vertex(&mut self, key: &K) -> Option<&mut T>
fn get_edge(&self, pair: (&K, &K)) -> Option<&E>
fn get_mut_edge(&mut self, pair: (&K, &K)) -> Option<&mut E>
Implementors§
impl<K: Hash + Eq + Clone, V, W: Add + Sub + Eq + Ord + Copy> DirectedGraph<SimpleVertex<K, V>, DirectedEdge<K, W>, K, V, W, CompoundKey<K>> for AdjacencyGraph<K, V, W>
AdjacencyGraph implement the DirectedGraph trait Specifying the vertex type (DirectedVertex),
the edge type (Directed Edge), and the edge key type (CompoundKey). But the vertex key type,
the vertex value type and the edge weight type remain generics.