Connections

Trait Connections 

Source
pub trait Connections<T> {
    type Error;

    // Required method
    fn connections(&self, x: T) -> Result<BTreeSet<&T>, Self::Error>;
}
Expand description

Connections lists all vertices y such that there is an edge from the vertex x to the vertex y. An error is thrown if x does not exist.

§Example

use btree_graph::{BTreeGraph, AddVertex, AddEdge, Connections};
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!(graph.connections(String::from("origin")).unwrap().contains(&String::from("destination")));

Required Associated Types§

Required Methods§

Source

fn connections(&self, x: T) -> Result<BTreeSet<&T>, Self::Error>

Implementors§

Source§

impl<V, E> Connections<V> for BTreeGraph<V, E>
where V: Ord, E: Ord,