pub struct PotentialUnionFind<T> { /* private fields */ }
Expand description
ポテンシャル付きUnionfind
Implementations§
Source§impl<T> PotentialUnionFind<T>where
T: AbelianGroup + Clone,
impl<T> PotentialUnionFind<T>where
T: AbelianGroup + Clone,
Sourcepub fn new_commutative(n: usize) -> Self
pub fn new_commutative(n: usize) -> Self
大きさn
のPotentialUnionFind
を生成する。(ポテンシャルが可換群のとき)
Source§impl<T> PotentialUnionFind<T>
impl<T> PotentialUnionFind<T>
Sourcepub fn new_non_commutative(n: usize) -> Self
pub fn new_non_commutative(n: usize) -> Self
大きさn
のPotentialUnionFind
を生成する。(ポテンシャルが可換とは限らない群のとき)
Sourcepub fn potential_of(&self, i: usize) -> T
pub fn potential_of(&self, i: usize) -> T
i
のポテンシャル($P(i)$)を返す。
Sourcepub fn diff(&self, i: usize, j: usize) -> Option<T>
pub fn diff(&self, i: usize, j: usize) -> Option<T>
i
とj
が同一の素集合に属するとき、ポテンシャルの差($P(i) - P(j)$)を返す。
Sourcepub fn merge(&mut self, i: usize, j: usize, p: T) -> usize
pub fn merge(&mut self, i: usize, j: usize, p: T) -> usize
i
の属する素集合とj
の属する素集合を統合する。
統合後は、$P(i) = P(j) + p$を満たす。
Sourcepub fn count_groups(&self) -> usize
pub fn count_groups(&self) -> usize
素集合の個数を返す。
Sourcepub fn get_groups(&self) -> Vec<Vec<usize>>
pub fn get_groups(&self) -> Vec<Vec<usize>>
素集合をすべて列挙する。
Auto Trait Implementations§
impl<T> !Freeze for PotentialUnionFind<T>
impl<T> !RefUnwindSafe for PotentialUnionFind<T>
impl<T> Send for PotentialUnionFind<T>where
T: Send,
impl<T> !Sync for PotentialUnionFind<T>
impl<T> Unpin for PotentialUnionFind<T>where
T: Unpin,
impl<T> UnwindSafe for PotentialUnionFind<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more