Trait union_find::UnionFind
[−]
[src]
pub trait UnionFind<V: Union>: FromIterator<V> + Sized { fn size(&self) -> usize; fn union(&mut self, key0: usize, key1: usize) -> bool; fn find(&mut self, key: usize) -> usize; fn get(&mut self, key: usize) -> &V; fn get_mut(&mut self, key: usize) -> &mut V; fn new(len: usize) -> Self where V: Default { ... } }
APIs for Union-Find operation.
Required Methods
fn size(&self) -> usize
Returns the size of self
.
fn union(&mut self, key0: usize, key1: usize) -> bool
Join two sets that contains given keys (Union operation).
Returns true
if these keys are belonged to different sets.
fn find(&mut self, key: usize) -> usize
Returns the identifier of the set that the key belongs to.
fn get(&mut self, key: usize) -> &V
Returns the reference to the value of the set that the key belongs to.
fn get_mut(&mut self, key: usize) -> &mut V
Returns the mutable reference to the value of the set that the key belongs to.
Provided Methods
Implementors
impl<V: Union> UnionFind<V> for QuickUnionUf<V>
impl<V: Union> UnionFind<V> for QuickFindUf<V>