Skip to content

Commit d387e36

Browse files
committed
Updated DSU
1 parent 4fc17b9 commit d387e36

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

data_structures/DSU.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ namespace alg::data_struct {
2424
return parent[vertex] = get(parent[vertex]);
2525
}
2626

27+
bool in_one_component(size_t vertex1, size_t vertex2) {
28+
return get(vertex1) == get(vertex2);
29+
}
30+
2731
bool unite(size_t vertex1, size_t vertex2) {
2832
vertex1 = get(vertex1);
2933
vertex2 = get(vertex2);

0 commit comments

Comments
 (0)