Trait graph::wcc::UnionFind

source ·
pub trait UnionFind<NI> {
    // Required methods
    fn union(&self, u: NI, v: NI);
    fn find(&self, u: NI) -> NI;
    fn len(&self) -> usize;
    fn compress(&self);
}

Required Methods§

source

fn union(&self, u: NI, v: NI)

Joins the set of id1 with the set of id2.

source

fn find(&self, u: NI) -> NI

Find the set of id.

source

fn len(&self) -> usize

Returns the number of elements in the union find, also referred to as its ‘length’.

source

fn compress(&self)

Compress the data if possible. After that operation each index stores the final set id.

Implementors§

source§

impl<NI: Idx> UnionFind<NI> for Afforest<NI>

source§

impl<NI: Idx> UnionFind<NI> for DisjointSetStruct<NI>