Each vertex in the vertex cover is adjacent to every vertex
What about the vertices not in the vertex cover, i.e. the compliment?
General Algorithm
defIndependentSet(G, k):
return VertexCover(G, n - k)
Some Precision
We need to prove two things:
If it finds a solution, then the solution is correct
If a solution exists, then our algorithm finds it
For our problem, that means:
The compliment of the vertex cover is an independent set
If an independent set of size exists, then a vertex cover of size
also exists
Proving the First Statement
The compliment of the vertex cover is an independent set
Suppose the statement is false
Two vertices not in the vertex cover are adjacent
Is that edge covered in the vertex cover?
Contradiction!
Proving the Second Statement
If an independent set of size exists, then a vertex cover of size
also exists
Show that an independent set of size means there is a vertex cover of size
Conveniently, just proving the reverse of the first statement!
Proving the Second Statement
The compliment of the independent set is a vertex cover
Suppose the statement is false
There is an edge that is not covered by the compliment
Means both vertices on the edge are in the independent set
But that makes them not independent anymore?
Contradiction!
Set Cover Problem
We are given a series of sets and a value , can you select no more than
sets such that every element in the sets is in at least one element of
the chosen?
Set Cover
Set Number
Elements
1
A, B
2
A, C, D, E
3
B, C, F, I
4
D, G
5
E, H
6
I, J
7
F, G, H, J
Set Cover
Set Number
Elements
1
A, B
2
A, C, D, E
3
B, C, F, I
4
D, G
5
E, H
6
I, J
7
F, G, H, J
Use Set Cover to Solve Vertex Cover
Solution is extremely natural!
Each vertex is a set
Each edge is an element of the set
The set numbers chosen are the vertices we choose!