aboutsummaryrefslogtreecommitdiff
path: root/graph/src/labelled/double.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graph/src/labelled/double.rs')
-rw-r--r--graph/src/labelled/double.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/graph/src/labelled/double.rs b/graph/src/labelled/double.rs
index a641c74..b01a13b 100644
--- a/graph/src/labelled/double.rs
+++ b/graph/src/labelled/double.rs
@@ -319,6 +319,8 @@ impl<T: GraphLabel> LabelGraph<T> for DLGraph<T> {
Self: 'a,
T: 'a;
+ type TupleIter<'a> = std::iter::Copied<std::slice::Iter<'a, (T, usize)>> where Self: 'a, T:'a;
+
fn edge_label(&self, source: usize, target: usize) -> Result<Self::EdgeLabelIter<'_>, Error> {
if self.has_edge(source, target)? {
Ok(EdgeLabelIter::new(
@@ -353,6 +355,14 @@ impl<T: GraphLabel> LabelGraph<T> for DLGraph<T> {
}
#[inline]
+ fn tuples_of(&self, node_id: usize) -> Result<Self::TupleIter<'_>, Error> {
+ match self.nodes.get(node_id) {
+ Some(node) => Ok(node.flat.iter().copied()),
+ None => Err(Error::IndexOutOfBounds(node_id, self.nodes.len())),
+ }
+ }
+
+ #[inline]
fn labels_of(&self, node_id: usize) -> Result<Self::LabelIter<'_>, Error> {
match self.nodes.get(node_id) {
Some(node) => Ok(Self::LabelIter::new(node.by_label.iter())),