From 3ae0cf9898485a2ec35df7d23cd274e7dea5796d Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 8 Jan 2024 16:13:19 +0800 Subject: a commit before the forst query I think the main functionalities are already there, but the lack of querying capabilities makes this not very useful at the moment. This commit is right before an attempt to add this missing piece. --- graph/src/labelled/double.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'graph/src/labelled/double.rs') 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 LabelGraph for DLGraph { Self: 'a, T: 'a; + type TupleIter<'a> = std::iter::Copied> where Self: 'a, T:'a; + fn edge_label(&self, source: usize, target: usize) -> Result, Error> { if self.has_edge(source, target)? { Ok(EdgeLabelIter::new( @@ -352,6 +354,14 @@ impl LabelGraph for DLGraph { } } + #[inline] + fn tuples_of(&self, node_id: usize) -> Result, 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, Error> { match self.nodes.get(node_id) { -- cgit v1.2.3-18-g5258