[prev] 91 [next]

Vertex Cover (cont)

An approximation algorithm for vertex cover:

approxVertexCover(G):
|  Input  undirected graph G=(V,E)
|  Output vertex cover of G
|
|  C=∅
|  E'=copy of E
|  while E'≠∅ do
|  |  choose any (v,w) ∈ E'
|  |  C = C∪{v,w}
|  |  E' = E' \ {all edges incident on v or w}
|  end while
|  return C