pulau_rs/quickunion/heuristics/
unweighted.rs

1//! Unweighted heuristic for QuickUnion
2
3use core::marker::PhantomData;
4
5use crate::{quickunion::Heuristic, rng::PhantomRng, Owned, VertexType};
6
7pub struct Unweighted<K = Owned>(PhantomData<K>);
8
9impl<K> Heuristic for Unweighted<K> {
10    type RngProvider = PhantomRng;
11
12    #[inline(always)]
13    fn handle_decision<T>(
14        a: T::IdentifierType,
15        b: T::IdentifierType,
16        _heuristic: &mut [usize],
17        representative: &mut [T],
18        _r: &mut Self::RngProvider,
19    ) where
20        T: VertexType,
21    {
22        if a == b {
23            return;
24        }
25        representative[T::usize(a)] = representative[T::usize(b)];
26    }
27}