Struct disjoint_sets::AUnionFind
[−]
[src]
pub struct AUnionFind { /* fields omitted */ }
Concurrent union-find representing a set of disjoint sets.
Warning
I don’t yet have good reason to believe that this is correct.
Methods
impl AUnionFind
[src]
fn new(size: usize) -> Self
Creates a new asynchronous union-find of size
elements.
fn len(&self) -> usize
The number of elements in all the sets.
fn is_empty(&self) -> bool
Is the union-find devoid of elements?
It is possible to create an empty AUnionFind
, but unlike with
UnionFind
it is not possible to add
elements.
fn union(&self, a: usize, b: usize) -> bool
Joins the sets of the two given elements.
Returns whether anything changed. That is, if the sets were
different, it returns true
, but if they were already the same
then it returns false
.
fn find(&self, element: usize) -> usize
Finds the representative element for the given element’s set.
fn equiv(&self, a: usize, b: usize) -> bool
Determines whether two elements are in the same set.
fn force(&self)
Forces all laziness, so that each element points directly to its set’s representative.
fn as_vec(&self) -> Vec<usize>
Returns a vector of set representatives.
Trait Implementations
impl Clone for AUnionFind
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more