[−][src]Struct visioncortex::disjoint_sets::Forests
Data structure for building disjoint sets
Implementations
impl<T> Forests<T> where
T: Eq + Hash,
[src]
T: Eq + Hash,
pub fn new() -> Self
[src]
pub fn count_sets(&mut self) -> usize
[src]
Counts the number of unique disjoint sets.
pub fn group_items(&mut self, items: &[T]) -> Vec<Vec<usize>>
[src]
Groups items
by their containing sets. The result is the indices of items in the provided items
that belongs to different disjoint sets. The order of groups is arbitrary.
Items that do not exist in the forest belongs to the same group that does not consist of other contained items.
pub fn make_set(&mut self, item: T)
[src]
Makes a new singleton set with exactly one element item
.
pub fn find_set(&mut self, item: &T) -> Option<Label>
[src]
Find the label of the set item
belongs to.
pub fn union(&mut self, item1: &T, item2: &T)
[src]
Unions the two sets containing item1
and item2
.
No-op if either item1
or item2
is not present (i.e. no make_set
has been made).
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Forests<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Forests<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Forests<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Forests<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Forests<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,