pub struct WeightedGeneralMatching { /* private fields */ }Expand description
Maximum-weight matching solver for a general undirected weighted graph.
Implementations§
Source§impl WeightedGeneralMatching
impl WeightedGeneralMatching
Sourcepub fn add_edge(&mut self, u: usize, v: usize, w: f64) -> GraphalgResult<()>
pub fn add_edge(&mut self, u: usize, v: usize, w: f64) -> GraphalgResult<()>
Add an undirected weighted edge (u, v, w).
Self-loops are ignored. Parallel edges are de-duplicated keeping the largest weight (only positive-contribution edges ever enter a maximum weight matching).
Sourcepub fn from_weighted_graph(g: &WeightedGraph) -> GraphalgResult<Self>
pub fn from_weighted_graph(g: &WeightedGraph) -> GraphalgResult<Self>
Build a solver from a WeightedGraph (treated as undirected; the larger
weight is kept for each pair).
Sourcepub fn edges(&self) -> Vec<(usize, usize, f64)>
pub fn edges(&self) -> Vec<(usize, usize, f64)>
The de-duplicated edge list as (u, v, w) with u < v, sorted.
Sourcepub fn solve(&self) -> GraphalgResult<WeightedMatchingResult>
pub fn solve(&self) -> GraphalgResult<WeightedMatchingResult>
Solve for a maximum-weight matching (not necessarily of maximum cardinality).
Sourcepub fn solve_max_cardinality(&self) -> GraphalgResult<WeightedMatchingResult>
pub fn solve_max_cardinality(&self) -> GraphalgResult<WeightedMatchingResult>
Solve for a maximum-weight matching among the maximum-cardinality matchings.
Trait Implementations§
Source§impl Clone for WeightedGeneralMatching
impl Clone for WeightedGeneralMatching
Source§fn clone(&self) -> WeightedGeneralMatching
fn clone(&self) -> WeightedGeneralMatching
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WeightedGeneralMatching
impl RefUnwindSafe for WeightedGeneralMatching
impl Send for WeightedGeneralMatching
impl Sync for WeightedGeneralMatching
impl Unpin for WeightedGeneralMatching
impl UnsafeUnpin for WeightedGeneralMatching
impl UnwindSafe for WeightedGeneralMatching
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