pub struct GraphColoring<T> { /* private fields */ }
Expand description
Defines a greedy graph coloring algorithm over a generic conflict graph.
Implementations§
Source§impl<'a, T> GraphColoring<T>
impl<'a, T> GraphColoring<T>
Sourcepub fn insert_conflict(&mut self, a: &T, b: &T)
pub fn insert_conflict(&mut self, a: &T, b: &T)
Add a conflict edge between a
and b
.
Sourcepub fn insert_conflicts<C>(&mut self, items: C)
pub fn insert_conflicts<C>(&mut self, items: C)
Add conflict edges between all given items.
pub fn has_nodes(&self) -> bool
provides a hashmap that gives the sharing frequencies
Sourcepub fn color_greedy(
&mut self,
bound: Option<i64>,
keep_self_color: bool,
) -> HashMap<T, T>
pub fn color_greedy( &mut self, bound: Option<i64>, keep_self_color: bool, ) -> HashMap<T, T>
Given an ordering
of T
s, find a mapping from nodes to T
s such
that no node has a neighbor with the same T
.
keep_self_color
indicates whether to keep the mapping of the node to
itself in the returned HashMap (since nodes are “colors”)
pub fn reverse_coloring(coloring: &HashMap<T, T>) -> HashMap<T, Vec<T>>
pub fn welsh_powell_coloring(&self) -> HashMap<T, T>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for GraphColoring<T>
impl<T> RefUnwindSafe for GraphColoring<T>where
T: RefUnwindSafe,
impl<T> Send for GraphColoring<T>where
T: Send,
impl<T> Sync for GraphColoring<T>where
T: Sync,
impl<T> Unpin for GraphColoring<T>where
T: Unpin,
impl<T> UnwindSafe for GraphColoring<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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more