pub struct ReversibleColoring<S: Set + ?Sized> { /* private fields */ }Expand description
A reversible ordered coloring.
Implementations§
Source§impl<S: Set + ?Sized> ReversibleColoring<S>
impl<S: Set + ?Sized> ReversibleColoring<S>
pub fn from_coloring(set: &S, coloring: Coloring<S>) -> Self
pub fn color_index_of(&self, item: &S::Item) -> Option<usize>
Sourcepub fn as_permutation(&self) -> Option<&S::Map<usize>>
pub fn as_permutation(&self) -> Option<&S::Map<usize>>
Returns the permutation represented by this coloring, if any.
If the coloring discrete then it defines a mapping
p : x -> self.reverse(x) that is a permutation of the partitioned set.
In that case, Some(p) is returned.
Otherwise, if the coloring is not discrete, None is returned.
Sourcepub fn individualize(&mut self, item: &S::Item) -> bool
pub fn individualize(&mut self, item: &S::Item) -> bool
Refine the coloring such that item is in its own cell of size 1.
Returns true if the individualization succeeded,
or false if item was already individualized.
pub fn deindividualize(&mut self, item: &S::Item) -> bool
Sourcepub fn is_finer_or_equal_to(&self, other: &Self) -> bool
pub fn is_finer_or_equal_to(&self, other: &Self) -> bool
Checks if self is a finer than or equal to other, assuming they
target the same set.
pub fn refine<F, C: Ord>(&mut self, f: F) -> bool
Sourcepub fn refine_with<F, C: Ord>(
&mut self,
refined_colors: &mut Vec<usize>,
f: F,
) -> bool
pub fn refine_with<F, C: Ord>( &mut self, refined_colors: &mut Vec<usize>, f: F, ) -> bool
Refine this coloring using the given sub-coloring.
The refined_colors array will be expended to include the newly added colors indexes.
Colors that have not been refined are not added to the array, even if their index changes.
If the array already contains old color indexes, they will be updated in place to
the new color index.