V - the graph vertex typeE - the graph edge typepublic class MaximumWeightBipartiteMatching<V,E> extends java.lang.Object implements MatchingAlgorithm<V,E>
Running time is $O(n(m+n \log n))$ where n is the number of vertices and m the number of edges of the input graph. Uses exact arithmetic and produces a certificate of optimality in the form of a tight vertex potential function.
This is the algorithm and implementation described in the LEDA book. See the LEDA Platform of Combinatorial and Geometric Computing, Cambridge University Press, 1999.
MatchingAlgorithm.Matching<V,E>, MatchingAlgorithm.MatchingImpl<V,E>DEFAULT_EPSILON| Constructor and Description |
|---|
MaximumWeightBipartiteMatching(Graph<V,E> graph,
java.util.Set<V> partition1,
java.util.Set<V> partition2)
Constructor.
|
MaximumWeightBipartiteMatching(Graph<V,E> graph,
java.util.Set<V> partition1,
java.util.Set<V> partition2,
java.util.function.Function<java.util.Comparator<java.math.BigDecimal>,org.jheaps.AddressableHeap<java.math.BigDecimal,V>> heapSupplier)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
MatchingAlgorithm.Matching<V,E> |
getMatching()
Compute a matching for a given graph.
|
java.math.BigDecimal |
getMatchingWeight()
Get the weight of the matching.
|
java.util.Map<V,java.math.BigDecimal> |
getPotentials()
Get the vertex potentials.
|
public MaximumWeightBipartiteMatching(Graph<V,E> graph, java.util.Set<V> partition1, java.util.Set<V> partition2)
graph - the input graphpartition1 - the first partition of the vertex setpartition2 - the second partition of the vertex setjava.lang.IllegalArgumentException - if the graph is not undirectedpublic MaximumWeightBipartiteMatching(Graph<V,E> graph, java.util.Set<V> partition1, java.util.Set<V> partition2, java.util.function.Function<java.util.Comparator<java.math.BigDecimal>,org.jheaps.AddressableHeap<java.math.BigDecimal,V>> heapSupplier)
graph - the input graphpartition1 - the first partition of the vertex setpartition2 - the second partition of the vertex setheapSupplier - a supplier for the addressable heap to use in the algorithm.java.lang.IllegalArgumentException - if the graph is not undirectedpublic MatchingAlgorithm.Matching<V,E> getMatching()
getMatching in interface MatchingAlgorithm<V,E>public java.util.Map<V,java.math.BigDecimal> getPotentials()
This is a tight non-negative potential function which proves the optimality of the maximum weight matching. See any standard textbook about linear programming duality.
public java.math.BigDecimal getMatchingWeight()
Copyright © 2019. All Rights Reserved.