[−][src]Trait btree_network::AddEdge
AddEdge
add an edge from the vertex x to the vertex y, if it is not there.
Example
extern crate alloc; use alloc::collections::btree_set::BTreeSet; use btree_network::{BTreeNetwork, AddVertex, AddEdge, 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")); let x_value: &BTreeSet<String> = network.get_vertex_value(String::from("origin")).unwrap(); assert!(x_value.contains(&String::from("destination"))); let y_value: &BTreeSet<String> = network.get_vertex_value(String::from("destination")).unwrap(); assert!(y_value.contains(&String::from("origin")));
Associated Types
Loading content...Required methods
Loading content...Implementors
impl<T> AddEdge<T> for BTreeNetwork<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
When you add an edge, you should make sure that the x, and y vertices exist.