Class MatchingAlgoAbstract
- All Implemented Interfaces:
MatchingAlgo
- Direct Known Subclasses:
MatchingAlgoAbstractBasedMaximum
,MatchingAlgoAbstractBasedMinimum
,MatchingAlgoAbstractCardinality
The class implements the interface by solving the problem on the index graph and then maps the results back to the original graph. The implementation for index graphs is abstract and left to the subclasses.
- Author:
- Barak Ugav
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jgalgo.alg.match.MatchingAlgo
MatchingAlgo.Builder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<V,
E> Matching <V, E> computeMaximumMatching
(Graph<V, E> g, WeightFunction<E> w) Compute the maximum weighted matching of a weighted undirected graph.<V,
E> Matching <V, E> computeMaximumPerfectMatching
(Graph<V, E> g, WeightFunction<E> w) Compute the maximum perfect matching of a weighted undirected graph.<V,
E> Matching <V, E> computeMinimumMatching
(Graph<V, E> g, WeightFunction<E> w) Compute the minimum weighted matching of a weighted undirected graph.<V,
E> Matching <V, E> computeMinimumPerfectMatching
(Graph<V, E> g, WeightFunction<E> w) Compute the minimum perfect matching of a weighted undirected graph.
-
Constructor Details
-
MatchingAlgoAbstract
public MatchingAlgoAbstract()Default constructor.
-
-
Method Details
-
computeMaximumMatching
Description copied from interface:MatchingAlgo
Compute the maximum weighted matching of a weighted undirected graph.To compute the maximum cardinality (non weighted) matching, pass
null
instead of the weight functionw
.- Specified by:
computeMaximumMatching
in interfaceMatchingAlgo
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- an undirected graphw
- an edge weight function- Returns:
- the computed matching
-
computeMinimumMatching
Description copied from interface:MatchingAlgo
Compute the minimum weighted matching of a weighted undirected graph.- Specified by:
computeMinimumMatching
in interfaceMatchingAlgo
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- an undirected graphw
- an edge weight function- Returns:
- the computed matching
-
computeMaximumPerfectMatching
Description copied from interface:MatchingAlgo
Compute the maximum perfect matching of a weighted undirected graph.A perfect matching in which each vertex has an adjacent matched edge is assumed to exist in the input graph, and if no such matching exist the behavior is undefined.
To compute the maximum cardinality (non weighted) perfect matching, pass
null
instead of the weight functionw
.- Specified by:
computeMaximumPerfectMatching
in interfaceMatchingAlgo
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- an undirected graphw
- an edge weight function- Returns:
- the computed perfect matching
-
computeMinimumPerfectMatching
Description copied from interface:MatchingAlgo
Compute the minimum perfect matching of a weighted undirected graph.A perfect matching in which each vertex has an adjacent matched edge is assumed to exist in the input graph, and if no such matching exist the behavior is undefined.
To compute the maximum cardinality (non weighted) matching, pass
null
instead of the weight functionw
. Note that this is equivalent toMatchingAlgo.computeMaximumPerfectMatching(Graph, WeightFunction)
.- Specified by:
computeMinimumPerfectMatching
in interfaceMatchingAlgo
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- an undirected graphw
- an edge weight function- Returns:
- the computed perfect matching
-