pub struct DisjointSetUnion { /* private fields */ }Expand description
UnionFind
Implementations§
Source§impl DisjointSetUnion
impl DisjointSetUnion
pub fn new(n: usize) -> DisjointSetUnion
pub fn find_root(&mut self, target: usize) -> usize
pub fn unite(&mut self, x: usize, y: usize) -> bool
pub fn is_same(&mut self, x: usize, y: usize) -> bool
pub fn size(&mut self, x: usize) -> usize
pub fn get_same_group(&mut self, x: usize) -> HashSet<usize>
pub fn get_all_groups(&mut self) -> HashMap<usize, HashSet<usize>>
Trait Implementations§
Source§impl Clone for DisjointSetUnion
impl Clone for DisjointSetUnion
Source§fn clone(&self) -> DisjointSetUnion
fn clone(&self) -> DisjointSetUnion
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 DisjointSetUnion
impl RefUnwindSafe for DisjointSetUnion
impl Send for DisjointSetUnion
impl Sync for DisjointSetUnion
impl Unpin for DisjointSetUnion
impl UnwindSafe for DisjointSetUnion
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