reset forest method

This commit is contained in:
Maximilian Keßler 2023-11-04 17:34:17 +01:00
parent 4c65b47f39
commit 433430f92c
Signed by: max
GPG key ID: BCC5A619923C0BA5
2 changed files with 12 additions and 0 deletions

View file

@ -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); 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 } // namespace ED

View file

@ -175,6 +175,8 @@ public:
bool is_inner(NodeId const id) const; bool is_inner(NodeId const id) const;
bool is_out_of_forest(NodeId const id) const; bool is_out_of_forest(NodeId const id) const;
void reset_forest();
private: private:
std::vector<Node> _nodes; std::vector<Node> _nodes;
size_type _num_edges; size_type _num_edges;