93 virtual size_t root(
size_t i)
112 const size_t parent =
id(i);
119 <<
"cycle detected in union-find structure";
242 const size_t l =
size();
248 for (
size_t i =
l; i <= n; ++i)
284template <
typename T,
class Compare = Aleph::less<T>>
304 return Compare()(p1.item, p2.item);
313 Pair p(item, std::numeric_limits<size_t>::max());
315 if (ptr->
i == std::numeric_limits<size_t>::max())
Exception handling system with formatted messages for Aleph-w.
#define ah_out_of_range_error_if(C)
Throws std::out_of_range if condition holds.
#define ah_logic_error_if(C)
Throws std::logic_error if condition holds.
void empty() noexcept
Empty the array.
void reserve(const size_t l, const size_t r)
Allocate a range of entries.
Dynamic set implemented using AVL binary search trees of type Avl_Tree<Key>.
Binary relation between a set of integers.
Fixed_Relation(const size_t n=0)
Initialize an empty binary relation of integers between 0 and n - 1.
size_t size() const noexcept
Return the number of items of the set (not of relation)
virtual size_t root(size_t i)
void verify_index(const size_t i) const
constexpr size_t get_num_blocks() const noexcept
Return the number of connected blocks, which is the number of equivalence classes.
void join(size_t i, size_t j)
Insert the pair '(i,j)' in the relation.
bool are_connected(size_t i, size_t j)
Return true if item i is related to item j.
void set_n(size_t n)
Set the number of items of the relation.
virtual ~Fixed_Relation()=default
size_t depth(size_t i) const
Binary relation between a set of items.
bool are_connected(const T &p, const T &q)
Return true if p and q are connected; inserts missing items into the relation.
size_t test_and_insert_new_item(const T &item)
void join(const T &p, const T &q)
Join p with q; inserts missing items into the relation.
DynSetAvlTree< Pair, Cmp > items_tree
Binary relation between a set of integers.
void verify_if_add_new_points(const size_t n)
size_t root(size_t i) override
Relation(const size_t n=0)
Initialize an empty relation of n elements between [0..n)
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
std::decay_t< typename HeadC::Item_Type > T
bool operator()(const Pair &p1, const Pair &p2) const noexcept
Pair(const T &__item, size_t __i)
Lazy and scalable dynamic array implementation.
Dynamic set implementations based on balanced binary search trees.