You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
602 B
20 lines
602 B
#pragma once
|
|
|
|
#include <container/small_vector.hpp>
|
|
|
|
struct UnionFindDisjointSet {
|
|
UnionFindDisjointSet() noexcept = default;
|
|
UnionFindDisjointSet(uint32_t size) noexcept;
|
|
|
|
void init(uint32_t size) noexcept;
|
|
|
|
int32_t find(uint32_t x) noexcept;
|
|
int32_t merge(uint32_t x, uint32_t y) noexcept;
|
|
|
|
void extract_disjoint_sets(uint32_t** disjoint_sets,
|
|
uint32_t* index_map,
|
|
uint32_t* disjoint_set_elem_count,
|
|
uint32_t& num_disjoint_set) noexcept;
|
|
|
|
small_vector_mp<int32_t> parent{};
|
|
};
|