V
- the graph vertex typeE
- the graph edge typepublic class GreedyVCImpl<V,E> extends Object implements VertexCoverAlgorithm<V>
ClarksonTwoApproxVCImpl
.VertexCoverAlgorithm.VertexCover<V>, VertexCoverAlgorithm.VertexCoverImpl<V>
Constructor and Description |
---|
GreedyVCImpl(Graph<V,E> graph)
Constructs a new GreedyVCImpl instance where all vertices have uniform weights.
|
GreedyVCImpl(Graph<V,E> graph,
Map<V,Double> vertexWeightMap)
Constructs a new GreedyVCImpl instance
|
Modifier and Type | Method and Description |
---|---|
VertexCoverAlgorithm.VertexCover<V> |
getVertexCover()
Finds a greedy solution to the minimum weighted vertex cover problem.
|
public GreedyVCImpl(Graph<V,E> graph)
graph
- input graphpublic VertexCoverAlgorithm.VertexCover<V> getVertexCover()
weight(v)/degree(v)
and adds it
to the cover. Next vertex v and all edges incident to it are removed. The process repeats
until all vertices are covered. Runtime: O(|E|*log|V|)getVertexCover
in interface VertexCoverAlgorithm<V>
Copyright © 2019. All rights reserved.