[−][src]Trait btree_graph::RemoveEdge
RemoveEdge
removes the edge from the vertex x to the vertex y, if it is there.
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); let removed_edge: (String, String) = graph.remove_edge(10).unwrap(); assert_eq!(removed_edge, (String::from("origin"), String::from("destination"))); 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);
Required methods
pub fn remove_edge(&mut self, x: E) -> Option<(V, V)>
[src]
Implementors
impl<V, E> RemoveEdge<V, E> for BTreeGraph<V, E> where
V: Ord + Clone,
E: Ord + Clone,
[src]
V: Ord + Clone,
E: Ord + Clone,
When an edge is removed, you should find the incident vertex and ensure the edge is removed from the vertex's adjacency list.