[−][src]Trait btree_dag::RemoveVertex
RemoveVertex
removes the vertex x, if it is there.
Example
extern crate alloc; use alloc::collections::btree_set::BTreeSet; use btree_dag::{BTreeDag, AddVertex, AddEdge, RemoveVertex, GetVertexValue, Vertices}; let mut dag: BTreeDag<String> = BTreeDag::new(); dag.add_vertex(String::from("origin")); dag.add_vertex(String::from("destination")); dag.add_edge(String::from("origin"), String::from("destination")); dag.remove_vertex(String::from("destination")); assert_eq!(dag.vertices().len(), 1); // Note: removing a vertex will also cascade delete any incident edges. assert_eq!(dag.get_vertex_value(String::from("origin")).unwrap().len(), 0);
Associated Types
Loading content...Required methods
fn remove_vertex(&mut self, x: T) -> Result<(), Self::Error>
[src]
Implementors
impl<T> RemoveVertex<T> for BTreeDag<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
When you remove a vertex, you should ensure there are no dangling edges.