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) -> Selfwhere 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 copy 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,

§

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> !RefUnwindSafe for PotentializedUnionFind<G>

§

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

§

impl<G> !Sync for PotentializedUnionFind<G>

§

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

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V