From 313bb6fe11dffa522fab1bf3744158cf217c900f Mon Sep 17 00:00:00 2001 From: gagolews Date: Mon, 18 Nov 2024 17:05:25 +0100 Subject: [PATCH] more --- src/c_gini_disjoint_sets.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/c_gini_disjoint_sets.h b/src/c_gini_disjoint_sets.h index 3208069..4f889f8 100644 --- a/src/c_gini_disjoint_sets.h +++ b/src/c_gini_disjoint_sets.h @@ -92,6 +92,13 @@ class CCountDisjointSets : public CDisjointSets{ if (x == y) throw std::invalid_argument("find(x) == find(y)"); if (y < x) std::swap(x, y); + + // NOTE: we could have implemented union-by-size here, + // as we have the cluster size info; + // but then we wouldn't have that the new parent=minimum ID of members; + // which we need elsewhere. + + // DisjointSet's merge part: this->par[y] = x; // update the parent of y this->k -= 1; // decrease the subset count