From 987c84f3454c687cca0efe0d471fcf00e052ecab Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 12 Feb 2023 12:07:34 +0800 Subject: Added the functionality of split or clone. I need more than the ability to clone nodes: I also need to split the nodes. Now this seems to be correctly added. --- graph/src/labelled/binary.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'graph/src/labelled') diff --git a/graph/src/labelled/binary.rs b/graph/src/labelled/binary.rs index 4ec7378..ce3a867 100644 --- a/graph/src/labelled/binary.rs +++ b/graph/src/labelled/binary.rs @@ -603,9 +603,11 @@ impl<'a, T: GraphLabel> BuilderMut for PLGBuilderMut<'a, T> { // node_id is now guaranteed to be valid. + let old_label = self.graph.nodes.get(node_id).unwrap().label; + self.graph.nodes.get_mut(node_id).unwrap().label = label; - self.graph.label_index_map.remove(&label); + self.graph.label_index_map.remove(&old_label); self.graph.label_index_map.insert(label, node_id); Ok(()) -- cgit v1.2.3-18-g5258