[Lemon-commits] deba: r3264 - lemon/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Fri Apr 20 16:06:08 CEST 2007


Author: deba
Date: Fri Apr 20 16:06:08 2007
New Revision: 3264

Modified:
   lemon/trunk/lemon/unionfind.h

Log:
Clear for unionfinds



Modified: lemon/trunk/lemon/unionfind.h
==============================================================================
--- lemon/trunk/lemon/unionfind.h	(original)
+++ lemon/trunk/lemon/unionfind.h	Fri Apr 20 16:06:08 2007
@@ -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.



More information about the Lemon-commits mailing list