[−][src]Trait btree_graph::Adjacent
Adjacent
tests whether there is an edge from the vertex x to the vertex y.
An error is thrown if either x, or y do not exist. By definition of adjacent there
must exist an edge e, with value (x, y) in order for vertices x, and y to be
considered adjacent.
Example
use btree_graph::{BTreeGraph, AddVertex, AddEdge, Adjacent}; 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.adjacent(String::from("origin"), String::from("destination")).unwrap()); // Note: the graph is directed, and the definition of adjacent // can be phrased, if there exists a relationship from x to y. Therefore // A and B adjacent does not imply B and A are adjacent. assert!(!graph.adjacent(String::from("destination"), String::from("origin")).unwrap());
Associated Types
Loading content...Required methods
Loading content...Implementors
impl<V, E> Adjacent<V> for BTreeGraph<V, E> where
V: Ord,
E: Ord,
[src]
V: Ord,
E: Ord,