pub struct UnionFind<T, M = HashMap<T, T>, E = ()> { /* private fields */ }
Expand description

A union find datastructure. Note that this implementation clones elements a lot. Generally, you should use the datastructure with small, preferably Copyable types, like integers. However, arbitrary Clone+PartialEq types are possible.

Implementations

Constructs a new union find, using a hashmap as backing

Constructs a new union find, using a hashmap as backing

Constructs a new union find, using a btreemap as backing

Constructs a new union find, allowing you to specify all type parameters.

Find an element in the union find. Performs no path shortening, but can be used through an immutable reference.

Use [find_shorten] for a more efficient find.

Find an element in the union find. Performs path shortening, which means you need mutable access to the union find.

Use [find] for an immutable version.

union two elements in the union find

union two elements in the union find

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.