lemon/unionfind.h
changeset 875 07ec2b52e53d
parent 800 28c7ad6f8d91
parent 867 5b926cc36a4b
child 877 141f9c0db4a3
     1.1 --- a/lemon/unionfind.h	Tue Mar 16 21:27:35 2010 +0100
     1.2 +++ b/lemon/unionfind.h	Wed Mar 17 10:29:57 2010 +0100
     1.3 @@ -1288,6 +1288,15 @@
     1.4        : index(_index), first_class(-1),
     1.5          first_free_class(-1), first_free_node(-1) {}
     1.6  
     1.7 +    /// \brief Clears the union-find data structure
     1.8 +    ///
     1.9 +    /// Erase each item from the data structure.
    1.10 +    void clear() {
    1.11 +      nodes.clear();
    1.12 +      classes.clear();
    1.13 +      first_free_node = first_free_class = first_class = -1;
    1.14 +    }
    1.15 +
    1.16      /// \brief Insert a new node into a new component.
    1.17      ///
    1.18      /// Insert a new node into a new component.