Download presentation
Presentation is loading. Please wait.
1
CS4234 Optimiz(s)ation Algorithms
L1 – Min-Vertex-Cover
2
Vertex Cover Definition:
A vertex cover for a graph G = (V, E) is a set S V such that for every edge e = (u, v) E, either u S or v S
3
Min-Vertex-Cover (MVC)
Definition: Given a graph G = (V, E), find a minimum-sized set S that is a vertex cover for G Analogy: Starbucks in Singapore Try Brute Force live at
4
Vertex-Cover is NP-Complete
The decision version Given a graph G = (V, E) and a parameter k, does there exist a Vertex-Cover of G of size k (vertices)? Proof: Vertex-Cover is in NP Vertex-Cover is NP-hard Clique p Vertex-Cover See revision slides from CS3230 (copied here)
5
1. VERTEX-COVERNP Input: An undirected graph G = (V, E) and an integer k Certificate: A subset V' of size k The O(V+E) verifying algorithm checks if |V'| = k and insert those vertices into a Hash Table in O(V); Then, it scans all edge (u, v) E in O(E) to check if at least one of u and v belongs to V' (O(1) per Hash Table check) Therefore, Vertex Cover is in NP
6
Agenda for showing more NP-complete problems
Using polynomial time reduction, we can obtain more NP-complete problems
7
2. CLIQUEpVERTEX-COVER
Given an undirected graph G = (V, E) and k (|V| = n), we construct a graph 𝐆 = (V, Ē) where (u, v) Ē iff (u, v) E Claim: G has a size-k clique iff 𝐆 has a size-(n-k) vertex cover 6 vertices, 10 edges K6 has 15 edges 6 vertices, 5 edges u0 u0 u1 u4 u4 u1 u5 u5 u2 u3 u2 u3 G G
8
G has a size-k clique G has a size-(n-k) vertex cover
Suppose V' V is a size-k clique of G, e.g. V' = {u1, u2, u3, u4} is a size-4 clique of G For any edge (u, v) Ē in the complement graph G , then (u, v) E Which implies that at least one of u or v does not belong to a clique V' As every pair of vertices in V' are connected by an edge in E and thus won’t be in Ē Hence, at least one of u and v belongs to V-V' (of size n-k), e.g. V-V' = {u0, u5} is a size-2 vertex cover of G All edge (u, v) Ē is covered by V-V', so V-V' (of size n-k) is a VC of G u0 G u1 u2 u3 u4 u5 u0 u1 u4 u5 u2 u3 G
9
G has a size-k clique G has a size-(n-k) vertex cover
Suppose U V is the size-(n-k) vertex cover of G , e.g. U = {u0, u5} is a size-2 vertex cover of G By definition of vertex cover, for all u, v V, if (u, v) Ē, then at least one of u and v belong to U The contrapositive of this statement is for all u, v V and both u and v do not belong to U (u, v) Ē (u, v) E Hence, V-U is a clique and has size = n-(n-k) = k, e.g. V' = {u1, u2, u3, u4} is a size-4 clique of G G u0 u1 u2 u3 u4 u5 u0 u4 u1 u5 u2 u3 G
10
VERTEX-COVER is NP-Complete
We have shown that: VERTEX-COVER is in NP VERTEX-COVER is NP-Hard Therefore, VERTEX-COVER is NP-Complete
11
Min-Vertex-Cover is NP-hard
Clearly, if we could efficiently find a MIN-VERTEX-COVER (an optimization problem), then we could also efficiently answer the decision version of VERTEX-COVER Hence finding a MIN-VERTEX-COVER is at least as hard as the decision version, and hence we term it NP-hard
12
Dealing with an NP-hard Problem
Desirable Solution: Fast (i.e., polynomial time) Optimal (i.e., yielding the best solution possible) Universal (i.e., good for all instances/inputs) In reality: Choose 2 out of 3: Deal with the special case (lost universality) Deal with parameterized solution (lost speed) Consider approximate solution (lost optimality)
13
MVC on (Binary) Tree – Special Case
Dynamic Programming solution: in(v) = 1 + min(in(w), out(w)) + min(in(z), out(z)) out(v) = in(w) + in(z) Base case at leaves: in(v) = 1, out(v) = 0 answer = min(in(r), out(r)), computable in O(n) Answer: 3, cover 1, 2, and 6 Try DP on Tree live at
14
MVC with small k – Parameterized Solution
Parameterized Complexity What if you are told that k 2? What if you are told that k is much smaller than n? Naïve O(nkm) algorithm Very not scalable Better O(2km) algorithm Also not scalable, but much better than the naïve one
15
MVC with small k – Parameterized Solution
Analysis: T(k, m) 2T(k-1, m) + O(m) O(2km) k = 0? No… The G can be simply EdgeList? k = 1 k = 0? Yes, (we are done)
16
Approx Algo for MVC – Deterministic 1
Can be very bad: ??-approximation (no bound)
17
Approx Algo for MVC – Deterministic 2
Not that bad? More analysis later
18
Approx Algo for MVC – Deterministic 3
Not that bad? More analysis later
19
Approx Algo for MVC – Deterministic 3
This is log-n factor worse than optimal answer
20
Zoomed-in
21
Approx Algo for MVC – Deterministic 2
This one has 2-approximation proof Let E' be the edges considered by this algorithm, this E' is actually a matching M (revisited in the next few weeks of CS4234, details in the PDF), E' = M |M| |OPT(G)| (details in the PDF) and C = 2*|E'| So C 2*|OPT(G)| Try Deterministic 2-Opt live at
22
Approx Algo for MVC - Randomized
2-approximation Analysis: Easy version: In line [5-8], the probability that we choose the right z is at least ½ We include z in the cover and remove z (and 'cover' its edges) in line 9-10 So C is at most 2 * OPT when E = Try Probabilistic 2-Opt live at
23
Summary Re-introducing the MVC problem
Re-proof that VC (decision) is NP-complete 3C2 scenarios Special case of MVC: On Binary Tree, use DP Parameterized MVC: Small k, good brute force Approximation algorithms for MVC Deterministic, 3 variants, but only variant 2 is 2-Approximation Randomized, Expected 2-Approximation
24
Admins PS1 is out today Will not due until Sat, 02 Sep 2017, 07.59am
PS: I still do not want to see this (variant of last year’s) problem posted in StackOverflow, Quora, GitHub, ideone, etc!!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.