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