Trait union_find::UnionFind [] [src]

pub trait UnionFind<V: Union>: FromIterator<V> + Extend<V> + Sized {
    fn size(&self) -> usize;
fn insert(&mut self, data: V) -> 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

Returns the size of self.

Inserts a new set into the union.

Returns the key of the inserted set.

Join two sets that contains given keys (union operation).

Returns true if these keys are belonged to different sets.

Returns the identifier of the set that the key belongs to.

Returns the reference to the value of the set that the key belongs to.

Returns the mutable reference to the value of the set that the key belongs to.

Provided Methods

Creates empty UnionFind struct.

Implementors