V
- the graph vertex typeE
- the graph edge typepublic class RecursiveExactVCImpl<V,E> extends Object implements VertexCoverAlgorithm<V>
$VC(G)$:
if $V = \emptyset$ then return $\emptyset$
Choose an arbitrary node $v \in G$
$G1 := (V − v, \left{ e \in E | v \not \in e \right})$
$G2 := (V − v − N(v), \left{ e \in E | e \cap (N(v) \cup v)= \empty \right})$
if $|v \cup VC(G1)| \leq |N(v) \cup VC(G2)|$ then
return $v \cup VC(G1)$
else
return $N(v) \cup VC(G2)$
To speed up the implementation, memoization and a bounding procedure are used. The current
implementation solves instances with 150-250 vertices efficiently to optimality.
TODO JK: determine runtime complexity and add it to class description. TODO JK: run this class
through a performance profilerModifier and Type | Class and Description |
---|---|
protected class |
RecursiveExactVCImpl.BitSetCover
Helper class which represents a vertex cover as a space efficient BitSet
|
VertexCoverAlgorithm.VertexCover<V>, VertexCoverAlgorithm.VertexCoverImpl<V>
Constructor and Description |
---|
RecursiveExactVCImpl(Graph<V,E> graph)
Constructs a new GreedyVCImpl instance
|
RecursiveExactVCImpl(Graph<V,E> graph,
Map<V,Double> vertexWeightMap)
Constructs a new GreedyVCImpl instance
|
Modifier and Type | Method and Description |
---|---|
VertexCoverAlgorithm.VertexCover<V> |
getVertexCover()
Computes a vertex cover.
|
public RecursiveExactVCImpl(Graph<V,E> graph)
graph
- input graphpublic VertexCoverAlgorithm.VertexCover<V> getVertexCover()
VertexCoverAlgorithm
getVertexCover
in interface VertexCoverAlgorithm<V>
Copyright © 2018. All rights reserved.