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;