This is not ready yet, but I have to go home...
5 * Ehhez nagyon fontos, hogy az atadott property map inicializalva legyen
6 * minden szobajovo kulcs ertekre, -1 -es ertekkel!
18 template <typename Key, typename KeyIntMap>
21 struct VectorElementType {
24 VectorElementType(int _boss, int _count){
29 std::vector<VectorElementType> container;
32 UnionFind(KeyIntMap& _pointmap): pointmap(_pointmap){
36 //Give a component of one point to the structure
38 int _index = container.size();
39 VectorElementType buf(_index,1);
40 container.push_back(buf);
45 //Finds the big boss of u
47 if (pointmap.get(u)==-1){
48 int whoami = addPoint(u);
49 pointmap.set(u, whoami);
53 int emp = pointmap.get(u);
54 int boss = container[emp].boss;
57 boss = container[emp].boss;
63 //Finds u and v in the structures and merges the comopnents, if not equal
64 bool findAndMerge(Key u,Key v){
77 void mergeInto(int a, int b){
78 container[a].boss = b;
79 container[b].count += container[a].count;
83 void unio(int b1, int b2){
84 if (container[b1].count>container[b2].count){