pub trait RemoveEdge<V, E> {
type Error;
// Required method
fn remove_edge(&mut self, x: E) -> Result<(), Self::Error>;
}Expand description
RemoveEdge removes the edge from the vertex x to the vertex y, if it is there. If the
edge does not exist, an error will be raised.
§Example
use btree_graph::{BTreeGraph, AddVertex, AddEdge, Edges, RemoveEdge, GetVertexValue};
let mut graph: BTreeGraph<String, usize> = BTreeGraph::new();
graph.add_vertex(String::from("origin"));
graph.add_vertex(String::from("destination"));
graph.add_edge(String::from("origin"), String::from("destination"), 10);
assert_eq!(graph.edges().len(), 1);
graph.remove_edge(10);
assert_eq!(graph.edges().len(), 0);
// Note: deletion of edges cascade i.e. the edge is also deleted from any incident
// vertices' adjacency lists.
assert_eq!(graph.get_vertex_value(String::from("origin")).unwrap().len(), 0);