[][src]Trait btree_network::RemoveEdge

pub trait RemoveEdge<T> {
    type Error;
    pub fn remove_edge(&mut self, x: T, y: T) -> Result<(), Self::Error>;
}

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);

Associated Types

Loading content...

Required methods

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

Loading content...

Implementors

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

When an edge is removed, you should find the incident vertex and ensure the edge is removed from the vertex's adjacency list.

type Error = Error

Loading content...