A vertex cover of an undirected graph G=(V,E) is a subset V′⊆V such that if (u,v)∈E, then u∈V′ or v∈V′ (or both)
Graph 의 어떤 Edge 이든 edge를 이루는 두 vertex 중 하나는 V′ 에 속함
The size of a vertex cover is the number of vertices in it
A vertex cover {w,z} of size 2
Goal: Finding a vertex cover of minimum size in a given graph
Optimization problem → Decision problem
Input: An undirected graph G=(V,E) and an integer k
Question: Is there a vertex cover of a given size k?
Vertex Cover Problem (NPC Proof)
1. NP 인지 증명 (=Polynomial time 으로 verification 가능해야함)
k 개의 edge 집합 V′ 가 주어진다면, edge 가 다 존재하는지 확인 → Polynomial time 으로 확인 가능
2. NP Complete Problem 으로부터 Polynomial time 으로 reduction 가능해야함
Clique ≤p Vertex Cover
Complement of G=(V,E) is Gˉ=(V,Eˉ) where Eˉ={(u,v):u,v∈V,u=v and (u,v)∈/E}
Reduction algorithm
Input: <G,k> of the clique problem
Compute Gˉ in polynomial time
Output: <Gˉ,∣V∣−k>
The graph G has a clique of size k iff the graph Gˉ has a vertex cover of size ∣V∣−k
Clique → Vertex Cover
Suppose that G has a clique V′⊆V with ∣V′∣=k
For any edge ∈Eˉ
At least one of u or v does not belong to V′
Equivalently, at least one of u or v is in V−V′→ edge (u,v) is covered by V−V′
Every edge of Eˉ is covered by V−V′
Gˉ 에 존재하는 edge 의 두 vertex 중 적어도 하나는 반드시 clique 에 속하지 않은 vertex 이다.
Vertex Cover → Clique
Suppose that Gˉ has a vertex cover V′⊆V,∣V′∣=∣V∣−k
For all u,v∈V, if (u,v)∈Eˉ,u∈V′ or v∈V′
The contrapositive of this implication is
For all u,v∈V, if u∈/V′ and v∈/V′, then (u,v)∈E
⇒V−V′ has a clique with size ∣V−V′∣=k
Subgraph Isomorphism
Subgraph Isomorphism
Isomorphism of graphs G and H is a bijection between the vertex sets of G and H
f:V(G)→V(H)
Any two vertices u and v of G are adjacent in G iff f(u) and f(v) are adjacent in H
Subgraph Isomorphism Problem
Input: G1=(V1,E1),G2=(V2,E2)
Question: Does G=(V,E) with V⊆V1, E⊆E1 exist such that ∣V∣=∣V2∣,∣E∣=∣E2∣ and
there is a one to one function f:V→V2 satisfying {u,v}∈E if {f(u),f(v)}∈E2? G1 의 subgraph G 가 G2 와 isomorphism 인지 찾는 문제
Subgraph Isomorphism Problem (NPC Proof)
1. NP 증명 (=Polynomial time 으로 verification 가능해야함)
Given G1=(V1,E1),G2=(V2,E2), for G=(V,E) and f,
we can verify that G is subgraph of G1 and isomorphic to G2 in polynomial time
By checking
V⊆V1,E⊆E1, ∣V∣=∣V2∣,∣E∣=∣E2∣
Every {u,v}∈E2 satisfy {f(u),f(v)}∈E
2. NP Complete Problem 으로부터 Polynomial time 으로 reduction 가능해야함
Clique ≤p Subgraph Isomorphism
Reduction algorithm
Input: <G,k> of the clique problem
Generate a complete graph G2 of size k in polynomial time
Output: <G1,G2>
Clique → Subgraph Isomorphism
G1이 k-clique 을 가진다면 생성된 G2 와 isomorphic한 G⊆G1 가 존재
G1이 k-clique 을 가지지 않는다면 생성된 G2 에 대해 어떤 f도 isomorphism 만족 불가
Subgraph Isomorphism → Clique
G⊆G1 가G2와 isomorphic 하다면 G1이 k-clique 을 가짐
Hitting Set
Hitting Set
Given a set T and a collection of sets C={S1,S2,…,Sn} where each Si is a subset of T
A hitting set H is a subset of T which intersects all sets in the collection with at least one element
for all i∈{1,2,…,n}, we have H∩Si=0
e.g.
T={1,2,3,4,5}
C={{1,2},{1,3},{3,4,5}}
H={1,3}
Hitting Set Problem
Finding a hitting set H of T with the minimum size
Optimization problem → Decision problem
Input: A set T, a collection of sets C={S1,S2,…,Sn}, where each Si is a subset of T and integer k
Question: Is there a hitting set H of T with ∣H∣=k?
Hitting Set Problem (NPC Proof)
1. NP 증명 (=Polynomial time 으로 verification 가능해야함)
For the certificate of a hitting set H, affirms that ∣H∣=k
Check H∩Si=0 for i=1,…,n
2. NP Complete Problem 으로부터 Polynomial time 으로 reduction 가능해야함
Vertex Cover ≤p Hitting Set
Let <G,k> be an instance of the vertex cover problem and G=(V,E)
Let T=V and for all (u,v)∈E, add a new set {u,v} to the collection C
여기서 Si 사이즈는 2개인 것만
Show that there is a hitting set H of size k iff if G has a vertex cover C of size k
Vertex Cover → Hitting Set
Suppose there is a vertex C for G for size k
For each edge (u,v) either u∈C or v∈C
Setting C to be H gives a hitting set of size k
Hitting Set → Vertex Cover
Suppose there is a hitting set H of size k
Since H contains at least one endpoint of each edge,
setting C to be H gives a vertex cover of size k
Subset-Sum
Subset-Sum Problem
Input: A finite set S of positive integers and an integer target t>0
Question: Is there a subset S′⊆S whose elements sum to t?
e.g.
S={1,2,7,14,49,98,343,686,2409,2793} and t=451
S′={1,2,7,98,343}
Subset-Sum (NPC Proof)
1. Subset-Sum ∈ NP
For an instance <S,t>, let the subset S′ be the certificate
Checking whether t=s∈S′∑s can be verified in polynomial time
2. 3-CNF-SAT ≤p Subset-Sum
Given 3-CNF formula ϕ over variable x1,x2,…,xn with clauses C1,C2,…,Ck
Assumption without loss of generality
Reduction algorithm
Input:
ϕ=C1∧C2∧C3∧C4
C1=(x1∨¬x2∨¬x3)
C2=(¬x1∨¬x2∨¬x3)
C3=(¬x1∨¬x2∨x3)
C4=(x1∨x2∨x3)
Label each digit position
variable: the most significant n digits
clause: the least signifiacant k digits
vi and vi′
xi set to 1 if i is same as vi
Ci set to 1 depending on variables in the clause
sj and sj′
For each clause Cj,
For sj, there is a 1 in the Cj digit and sj′ has a 2 in this digit (=slack variables)
the ohter sj has 0
Output:
S={1001001,1000110,⋯,1000,⋯,2}
Each row becomes Si
t=1114444
A 1 in each variable-labeled digit and a 4 in each clause-labeled digit
모든 i 에 대하여 vi 와 vi′ 중 반드시 하나씩 선택
Ci 는 1개 이상만 선택되면 됨
3-CNF-SAT → Subset-Sum
Suppose that ϕ has a satisfying assignment <x1=0,x2=0,x3=1>
If xi=1, then include vi in S′
If xi=0, then include vi′ in S′
S′ includes {v1′,v2′,v3}
True 가 되는 assignment 를 가진다면, Ci 중 vi,vi′ 는 둘 중 하나만 선택되어 t 의 xi digit, si,si′ 를 통해 t 의 Ci digit 을 만족 가능
Subset-Sum → 3-CNF-SAT
Suppose that there is a subset S′⊆S that sums to t
If vi∈S′, set xi=1
If vi′∈S′, set xi=0
Every clause Cj, for j=1,…,k is satisfied by this assignment
By the subset S′ (yellow) matches to the t, every Cj set to 1
Partition
Partition Problem
Input: A finite set S of numbers
Question: Can the numbers in S be partitioned into two sets S1 and S2=S−S1 such that Summation of S1 and S2 are equal
e.g.
S={1,2,7,10}
S1={1,2,7},S2={10}
Partition Problem (NPC Proof)
1. Partition ∈ NP
For a set S, let the subsets S1 and S2=S−S1 be the certificate
Checking whether summation can be accomplished by a verficiation in polynomial time
2. Subset-Sum ≤p Partition
Reduction algorithm
Input: <S,t> of the subset-sum problem
S′=S∪{2a,3a,4a+2t},a=(Σx∈Sx)
Output: <S′>(Σx∈S,x=10a+2t)
If there is B′ that Σx∈B′x=t, make C′=B′∪{2a,3a}
Σx∈C′x=t+2a+3a=5a+t
Σx∈(S′−C′)x=10a+2t−Σx∈C′x=5a+t
Therefore, partition exists
Subset-Sum → Partition
만약 합이 t 인 set A⊆S 가 존재한다면 A∪{2a,3a} 로 partiton 가능
Partition → Subset-Sum
4a+2t 는 2a,3a 와 같은 집합이 될 수 없음
4a+2t 와 같이 partition 되는 집합의 합은 a−t
반대 set 은 2a+3a=5a→ 나머지 부분집합의 합이 t 이어야함