add a few accessors to Graph

This commit is contained in:
Niko Matsakis 2015-08-18 17:56:25 -04:00
parent 004d70212a
commit 4f5267dba3

View File

@ -119,11 +119,21 @@ impl<N:Debug,E:Debug> Graph<N,E> {
&self.nodes
}
#[inline]
pub fn len_nodes(&self) -> usize {
self.nodes.len()
}
#[inline]
pub fn all_edges<'a>(&'a self) -> &'a [Edge<E>] {
&self.edges
}
#[inline]
pub fn len_edges(&self) -> usize {
self.edges.len()
}
///////////////////////////////////////////////////////////////////////////
// Node construction