pub trait RemoveEdge<T> {
type Error;
// Required method
fn remove_edge(&mut self, x: T, y: T) -> Result<(), Self::Error>;
}Expand description
RemoveEdge removes the edge from the vertex x to the vertex y, if it is there.
§Example
use btree_network::{BTreeNetwork, AddVertex, AddEdge, RemoveEdge, GetVertexValue};
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_edge(String::from("origin"), String::from("destination"));
// Note: deletion of edges cascade i.e. the edge is also deleted from any incident
// vertices' adjacency lists.
assert_eq!(network.get_vertex_value(String::from("origin")).unwrap().len(), 0);
assert_eq!(network.get_vertex_value(String::from("destination")).unwrap().len(), 0);Required Associated Types§
Required Methods§
fn remove_edge(&mut self, x: T, y: T) -> Result<(), Self::Error>
Implementors§
Source§impl<T> RemoveEdge<T> for BTreeNetwork<T>
When an edge is removed, you should find the incident vertex and ensure the edge
is removed from the vertex’s adjacency list.
impl<T> RemoveEdge<T> for BTreeNetwork<T>
When an edge is removed, you should find the incident vertex and ensure the edge is removed from the vertex’s adjacency list.