Struct visioncortex::disjoint_sets::Forests
source · pub struct Forests<T>{ /* private fields */ }
Expand description
Data structure for building disjoint sets
Implementations§
source§impl<T> Forests<T>
impl<T> Forests<T>
pub fn new() -> Self
sourcepub fn count_sets(&mut self) -> usize
pub fn count_sets(&mut self) -> usize
Counts the number of unique disjoint sets.
sourcepub fn group_items(&mut self, items: &[T]) -> Vec<Vec<usize>>
pub fn group_items(&mut self, items: &[T]) -> Vec<Vec<usize>>
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.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Forests<T>
impl<T> RefUnwindSafe for Forests<T>where
T: RefUnwindSafe,
impl<T> Send for Forests<T>where
T: Send,
impl<T> Sync for Forests<T>where
T: Sync,
impl<T> Unpin for Forests<T>where
T: Unpin,
impl<T> UnwindSafe for Forests<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more