# HG changeset patch # User deba # Date 1177077968 0 # Node ID d40c31b08d6feae5ea7d24cc545dd94f45f1e10f # Parent 6e1027a05d738bb713b0077381953dc4ceef91ea Clear for unionfinds diff -r 6e1027a05d73 -r d40c31b08d6f lemon/unionfind.h --- a/lemon/unionfind.h Thu Apr 19 15:14:34 2007 +0000 +++ b/lemon/unionfind.h Fri Apr 20 14:06:08 2007 +0000 @@ -101,6 +101,13 @@ return repIndex(index[a]); } + /// \brief Clears the union-find data structure + /// + /// Erase each item from the data structure. + void clear() { + items.clear(); + } + /// \brief Inserts a new element into the structure. /// /// This method inserts a new element into the data structure. @@ -285,6 +292,14 @@ items.push_back(t); } + /// \brief Clears the union-find data structure + /// + /// Erase each item from the data structure. + void clear() { + items.clear(); + firstClass = -1; + } + /// \brief Finds the leader of the component of the given element. /// /// The method returns the leader of the component of the given element.