pub struct DisjointSetUnionRollback { /* private fields */ }Expand description
UnionFind 経路圧縮を行わないことで undo を可能にする
Implementations§
Source§impl DisjointSetUnionRollback
impl DisjointSetUnionRollback
Sourcepub fn new(n: usize) -> DisjointSetUnionRollback
pub fn new(n: usize) -> DisjointSetUnionRollback
要素数 n の dsu を構築する
Sourcepub fn unite(&mut self, x: usize, y: usize) -> bool
pub fn unite(&mut self, x: usize, y: usize) -> bool
対象の木をマージ 経路圧縮を行わないため変更されるノード数は高々2 変更箇所をスタックで保存
Sourcepub fn get_history_length(&self) -> usize
pub fn get_history_length(&self) -> usize
現時点での保存されている操作回数を返す
Sourcepub fn rollback_snapshot(&mut self)
pub fn rollback_snapshot(&mut self)
rollback_snapshot で保存された状態へ復元
Sourcepub fn get_same_group(&mut self, x: usize) -> HashSet<usize>
pub fn get_same_group(&mut self, x: usize) -> HashSet<usize>
同じ木に含まれるノードを返す
Trait Implementations§
Source§impl Clone for DisjointSetUnionRollback
impl Clone for DisjointSetUnionRollback
Source§fn clone(&self) -> DisjointSetUnionRollback
fn clone(&self) -> DisjointSetUnionRollback
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DisjointSetUnionRollback
impl RefUnwindSafe for DisjointSetUnionRollback
impl Send for DisjointSetUnionRollback
impl Sync for DisjointSetUnionRollback
impl Unpin for DisjointSetUnionRollback
impl UnwindSafe for DisjointSetUnionRollback
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