Skip to content

Commit 486fd0e

Browse files
committed
more consistent var names with other graph algs
1 parent 7ffd55d commit 486fd0e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/dsu/dsu.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
struct DSU {
44
vi p;
55
DSU(int n): p(n, -1) {}
6-
int size(int x) { return -p[f(x)]; }
7-
int f(int x) { return p[x] < 0 ? x : p[x] = f(p[x]); }
8-
bool join(int a, int b) {
9-
if ((a = f(a)) == (b = f(b))) return 0;
10-
if (p[a] > p[b]) swap(a, b);
11-
return p[a] += p[b], p[b] = a, 1;
6+
int size(int u) { return -p[f(u)]; }
7+
int f(int u) { return p[u] < 0 ? u : p[u] = f(p[u]); }
8+
bool join(int u, int v) {
9+
if ((u = f(u)) == (v = f(v))) return 0;
10+
if (p[u] > p[v]) swap(u, v);
11+
return p[u] += p[v], p[v] = u, 1;
1212
}
1313
};

0 commit comments

Comments
 (0)