Skip to main content

VariableVertexes

Trait VariableVertexes 

Source
pub trait VariableVertexes<T, E, K, V, W, C>: 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 add_vertex(&mut self, vertex: T) -> Option<T>; fn remove_vertex(&mut self, key: K) -> Option<T>; }
Expand description

This trait adds to a Directed graph the methods to add and remove edges

Required Methods§

Source

fn add_vertex(&mut self, vertex: T) -> Option<T>

If a vertex with an equal key is already present, the vertex is updated (not the key) and the old vertex is returned ad Some(old_vertex). If not present None is returned.

Source

fn remove_vertex(&mut self, key: K) -> Option<T>

If the removed vertex was present it’s removed and returned as Some(vertex). Otherwise None is returned

Implementors§

Source§

impl<K: Hash + Eq + Clone, V, W: Add + Sub + Eq + Ord + Copy> VariableVertexes<SimpleVertex<K, V>, DirectedEdge<K, W>, K, V, W, CompoundKey<K>> for AdjacencyGraph<K, V, W>

AdjacencyGraph uses HashMaps to store vertexes, allowing fast insertion and removal of the latter