[][src]Trait btree_network::RemoveVertex

pub trait RemoveVertex<T> where
    T: Ord
{ type Error; pub fn remove_vertex(&mut self, x: T) -> Result<(), Self::Error>; }

RemoveVertex removes the vertex x, if it is there.

Example

extern crate alloc;
use alloc::collections::btree_set::BTreeSet;
use btree_network::{BTreeNetwork, AddVertex, AddEdge, RemoveVertex, GetVertexValue, Vertices};
let mut network: BTreeNetwork<String> = BTreeNetwork::new();
network.add_vertex(String::from("origin"));
network.add_vertex(String::from("destination"));
network.add_edge(String::from("origin"), String::from("destination"));


network.remove_vertex(String::from("destination"));
assert_eq!(network.vertices().len(), 1);

// Note: removing a vertex will also cascade delete any incident edges, which will then
// cascade delete any edges from the origin existing vertices' adjacency list.
assert_eq!(network.get_vertex_value(String::from("origin")).unwrap().len(), 0);

Associated Types

Loading content...

Required methods

pub fn remove_vertex(&mut self, x: T) -> Result<(), Self::Error>[src]

Loading content...

Implementors

impl<T> RemoveVertex<T> for BTreeNetwork<T> where
    T: Ord + Clone
[src]

When you remove a vertex, you should ensure there are no dangling edges.

type Error = Error

Loading content...