From 433430f92c3a8ed4fdabf39538a34e1264d5daf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 4 Nov 2023 17:34:17 +0100 Subject: [PATCH] reset forest method --- graph.cpp | 10 ++++++++++ graph.hpp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/graph.cpp b/graph.cpp index e1aa1f2..1a88fa1 100644 --- a/graph.cpp +++ b/graph.cpp @@ -196,4 +196,14 @@ bool Graph::is_out_of_forest(const ED::NodeId id) const ear_or_root_neighbor(matched_neighbor(id)) == matched_neighbor(id); } +void Graph::reset_forest() +{ + NodeId cur_id = 0; + for(auto & node : _nodes) { + node._ear_or_root_neighbor = cur_id; + node._root_of_ear_component = cur_id; + // Note that we do not change the matching itself here + } +} + } // namespace ED diff --git a/graph.hpp b/graph.hpp index afe1f97..632e507 100644 --- a/graph.hpp +++ b/graph.hpp @@ -175,6 +175,8 @@ public: bool is_inner(NodeId const id) const; bool is_out_of_forest(NodeId const id) const; + + void reset_forest(); private: std::vector _nodes; size_type _num_edges;