Struct disjoint_sets::UnionFind [] [src]

pub struct UnionFind<Element: ElementType = usize> { /* fields omitted */ }

Array-based union-find representing a set of disjoint sets.

Methods

impl<Element: ElementType> UnionFind<Element>
[src]

Creates a new union-find of size elements.

Panics

If size elements would overflow the element type Element.

The number of elements in all the sets.

Is the union-find devoid of elements?

It is possible to create an empty UnionFind and then add elements with alloc.

Creates a new element in a singleton set.

Panics

If allocating another element would overflow the element type Element.

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.

Finds the representative element for the given element’s set.

Determines whether two elements are in the same set.

Forces all laziness, so that each element points directly to its set’s representative.

Returns a vector of set representatives.

Trait Implementations

impl<Element: Clone + ElementType> Clone for UnionFind<Element>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<Element: Debug + ElementType> Debug for UnionFind<Element>
[src]

Formats the value using the given formatter.

impl<Element: ElementType> Default for UnionFind<Element>
[src]

Returns the "default value" for a type. Read more