[][src]Trait btree_graph::Connections

pub trait Connections<T> {
    type Error;
    pub fn connections(&self, x: T) -> Result<BTreeSet<&T>, Self::Error>;
}

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

Associated Types

Loading content...

Required methods

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

Loading content...

Implementors

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

type Error = Error

Loading content...