[][src]Trait generic_graph::DirectedGraph

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>, 
{ 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_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>; }

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

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

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

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

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>

Loading content...

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>[src]

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.

fn adjacent(&self, from: &K, to: &K) -> bool[src]

Check if an edge going from the first to the second vertex exists

fn neighbors(&self, from: &K) -> Vec<&K>[src]

Returns a Vector containing the keys of the vertexes reached by edges leaving from the vertex identified by the passed key

fn leading_to(&self, to: &K) -> Vec<&K>[src]

Returns a vector containing the keys of the Vertexes from which an edge leave to reach the vertex identified by the passed key

fn get_vertex(&self, key: &K) -> Option<&SimpleVertex<K, V>>[src]

Returns a reference to the vertex identified by the passed key

fn get_mut_vertex(&mut self, key: &K) -> Option<&mut SimpleVertex<K, V>>[src]

Returns a mutable reference to the vertex identified by the passed key

fn get_edge(&self, pair: (&K, &K)) -> Option<&DirectedEdge<K, W>>[src]

Returns a reference to the edge identified by the passed pair of keys

fn get_mut_edge(&mut self, pair: (&K, &K)) -> Option<&mut DirectedEdge<K, W>>[src]

Returns a mutable reference to the edge identified by the passed pair of keys

Loading content...