Struct lgl::graph::DirectedGraph
[−]
[src]
pub struct DirectedGraph<'a, T: 'a + Eq + Hash> { /* fields omitted */ }
A directed graph. Each edge has a source and target vertex.
Warning
This implementation is not thread-safe
Methods
impl<'a, T: 'a + Eq + Hash> DirectedGraph<'a, T>
[src]
fn new() -> DirectedGraph<'a, T>
Constructs an empty directed graph.
fn add_vertex(&mut self, v: &'a T)
Adds a vertex labeled with the input vertex.
Returns true
i.f.f. this vertex was not previously in the graph.
fn add_edge(&mut self, v: &'a T, u: &'a T)
Given two vertices, u
and v
, creates an edge u -> v
.
These vertices do not need to be in the graph before calling this method for this work.
fn is_edge(&mut self, v: &'a T, u: &'a T) -> bool
Returns true
i.f.f. there is an edge u -> v
.
fn neighbors(&mut self, v: &'a T) -> HashSet<&'a T>
Get the set of neighbors for a given vertex.