Skip to main content

PotentializedUnionFind

Struct PotentializedUnionFind 

Source
pub struct PotentializedUnionFind<G: CommutativeGroup>
where <G as Magma>::Set: Clone,
{ /* private fields */ }
Expand description

ポテンシャルつき union-find。

§Idea

通常の union-find に加え、配列 pot を管理する。 親ノード par と子ノード child に対して、pot[child] には phi(child) - phi(par) を持つようにする。

代表元を探してパスを縮約する際、ポテンシャル差の更新を適切に行う。

Implementations§

Source§

impl<G: CommutativeGroup> PotentializedUnionFind<G>
where <G as Magma>::Set: Clone,

Source

pub fn with_len(n: usize) -> Self
where G: Default,

Trait Implementations§

Source§

impl<G: Clone + CommutativeGroup> Clone for PotentializedUnionFind<G>
where <G as Magma>::Set: Clone,

Source§

fn clone(&self) -> PotentializedUnionFind<G>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<G: CommutativeGroup> PotentialFunction for PotentializedUnionFind<G>
where <G as Magma>::Set: Clone,

Source§

type Item = G

要素の型。
Source§

fn new(n: usize, cgroup: G) -> Self

要素数 $n$ の集合 $\{0, 1, \dots, n-1\}$ で初期化する。
Source§

fn len(&self) -> usize

集合の要素数 $n$ を返す。
Source§

fn relate(&mut self, u: usize, v: usize, w: G::Set) -> Result<bool, G::Set>

ポテンシャルの差を定義する。 Read more
Source§

fn diff(&self, u: usize, v: usize) -> Option<G::Set>

ポテンシャルの差を求める。 Read more
Source§

fn repr_diff(&self, u: usize) -> (usize, G::Set)

代表元とのポテンシャルの差を求める。
Source§

fn is_empty(&self) -> bool

集合が空であれば true を返す。

Auto Trait Implementations§

§

impl<G> !Freeze for PotentializedUnionFind<G>

§

impl<G> !RefUnwindSafe for PotentializedUnionFind<G>

§

impl<G> Send for PotentializedUnionFind<G>
where <G as Magma>::Set: Sized + Send, G: Send,

§

impl<G> !Sync for PotentializedUnionFind<G>

§

impl<G> Unpin for PotentializedUnionFind<G>
where <G as Magma>::Set: Sized + Unpin, G: Unpin,

§

impl<G> UnsafeUnpin for PotentializedUnionFind<G>
where <G as Magma>::Set: Sized, G: UnsafeUnpin,

§

impl<G> UnwindSafe for PotentializedUnionFind<G>
where <G as Magma>::Set: Sized + UnwindSafe, G: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V