Package com.jgalgo.alg.cover
Class VertexCoverAbstract
java.lang.Object
com.jgalgo.alg.cover.VertexCoverAbstract
- All Implemented Interfaces:
VertexCover
- Direct Known Subclasses:
VertexCoverBarYehuda
Abstract class for computing a minimum vertex cover.
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<V,
E> Set <V> computeMinimumVertexCover
(Graph<V, E> g, WeightFunction<V> w) Compute a minimum vertex cover of a graph with respect to a vertex weight function.
-
Constructor Details
-
VertexCoverAbstract
public VertexCoverAbstract()Default constructor.
-
-
Method Details
-
computeMinimumVertexCover
Description copied from interface:VertexCover
Compute a minimum vertex cover of a graph with respect to a vertex weight function.Note that finding the minimum vertex cover is an NP-hard problem, therefore the result of this function is an approximation of the optimal solution.
If
g
isIntGraph
, the returned object isIntSet
. Ifg
isIntGraph
, prefer to passIWeightFunction
asw
to avoid boxing/unboxing.- Specified by:
computeMinimumVertexCover
in interfaceVertexCover
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graphw
- a vertex weight function- Returns:
- a minimum vertex cover
-