src/work/johanna/unionfind.h
changeset 220 7deda4d6a07a
parent 150 4b5210aa0239
child 349 42c660f58702
equal deleted inserted replaced
0:1285910d7327 1:309ebe8161e5
     1 // -*- c++ -*- //
     1 // -*- c++ -*- //
     2 #ifndef UNION_FIND_H
     2 #ifndef HUGO_UNION_FIND_H
     3 #define UNION_FIND_H
     3 #define HUGO_UNION_FIND_H
     4 
     4 
     5 #include <vector>
     5 #include <vector>
     6 #include <utility>
     6 #include <utility>
     7 
     7 
     8 namespace hugo {
     8 namespace hugo {
    66 	data[cb].second += data[ca].second;
    66 	data[cb].second += data[ca].second;
    67       }
    67       }
    68       return true;
    68       return true;
    69     }
    69     }
    70 
    70 
       
    71     int componentSize(T a)
       
    72     {
       
    73       int ca = whichComponent(a);
       
    74       return data[ca].second;
       
    75     }
       
    76 
    71   };
    77   };
    72 
    78 
    73 } //namespace hugo
    79 } //namespace hugo
    74 
    80 
    75 #endif //UNION_FIND_H
    81 #endif //HUGO_UNION_FIND_H