[][src]Trait btree_dag::RemoveEdge

pub trait RemoveEdge<T> {
    type Error;
    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_dag::{BTreeDag, AddVertex, AddEdge, RemoveEdge, GetVertexValue};
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_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!(dag.get_vertex_value(String::from("origin")).unwrap().len(), 0);
assert_eq!(dag.get_vertex_value(String::from("destination")).unwrap().len(), 0);

Associated Types

Loading content...

Required methods

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

Loading content...

Implementors

impl<T> RemoveEdge<T> for BTreeDag<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...