Neeldhara
  • About
  • Research
    • Overview
    • People
    • Publications
    • Surveys
  • Teaching
    • Courses
    • Materials
  • Lists
    • Puzzles
    • Bookmarks
  • Exposition
    • Talks
    • Videos
  • Events
  • Blog

191014K02 | Day 2 Lecture 1

191014K02: Day 2 Lecture 1

Back to the Course Page

Vertex Cover

Vertex Cover [Optimization]

Input: A graph G=(V,E)G = (V,E)G=(V,E).

Task: Find S⊆V(G)S \subseteq V(G)S⊆V(G) such that for all edges (u,v)∈E(G)(u,v) \in E(G)(u,v)∈E(G), {u,v}∩S≠∅\{u,v\} \cap S \neq \varnothing{u,v}∩S=∅ and minimize ∣S∣|S|∣S∣.

Vertex Cover [Decision Version Edition]

Input: A graph G=(V,E)G = (V,E)G=(V,E) and k∈Z+k \in \mathbb{Z}^+k∈Z+.

Task: Find S⊆V(G)S \subseteq V(G)S⊆V(G) such that for all edges (u,v)∈E(G)(u,v) \in E(G)(u,v)∈E(G), {u,v}∩S≠∅\{u,v\} \cap S \neq \varnothing{u,v}∩S=∅ and ∣S∣⩽k|S| \leqslant k∣S∣⩽k.

The naive algorithm by brute force — examining all possible subsets — is O(nk⋅m)O(n^k \cdot m)O(nk⋅m) in damages. Can we do better?

The answer turns out to be yes: we can improve from O(nk⋅m)O(n^k \cdot m)O(nk⋅m) to deterministic 2k⋅nO(1)2^k \cdot n^{O(1)}2k⋅nO(1) time, which is fixed-parameter tractable in kkk.

Having said that, we will begin with a very elegant randomized algorithm for Vertex Cover, which essentially picks an edge at random and then, one of its endpoints at random, for as long as it can.

Cute randomized algorithm ALG

S=∅S=\varnothingS=∅

while G−SG-SG−S has at least one edge:

  • pick u,v∈E(G−S)u,v \in E(G-S)u,v∈E(G−S) u.a.r.
  • pick s∈{u,v}s \in\{u,v\}s∈{u,v} u.a.r
  • Set S←S∪{s}S \leftarrow S \cup\{s\}S←S∪{s}

Output SSS

Here are few claims about cute algorithm:

  1. ALG always runs in polynomial1 time.
  2. SSS is always a vertex cover.
  3. Pr⁡\operatorname{Pr}Pr[SSS is an optimal vertex cover] ⩾1/2k\geqslant 1/2^k⩾1/2k.

The first two claims follow quite directly from the operations of the algorithm and the definition of a vertex cover.

What about the third? Well: let OPT be some fixed optimal vertex cover. Suppose ∣|∣OPT∣⩽k| \leqslant k∣⩽k. Initially, note that S⊆S \subseteqS⊆ OPT. In each round, Pr⁡\operatorname{Pr}Pr[s∈Ss \in Ss∈S] ⩾1/2\geqslant 1/2⩾1/2, since S∩{u,v}≠∅S \cap \{u,v\} \neq \varnothingS∩{u,v}=∅ by definition. If s∈s \ins∈ OPT in every round of the algorithm, then S=S =S= OPT, which is awesome: and said awesomeness manifests with probability 1/2k1/2^k1/2k.

Bonus: repeat the algorithm and retain the smallest solution to get an overall constant success probability:

1−(1−12k)2k⩾1−1/e.1-\left(1-\frac{1}{2^k}\right)^{2^k} \geqslant 1-1 / e.1−(1−2k1​)2k⩾1−1/e.

Approximation. Do we expect ALG to be a reasonable approximation? It turns out: yes!

In particular: we will show that the size of the vertex cover output by ALG is at most twice ∣|∣OPT∣|∣ in expectation.

For a graph GGG, define XGX_GXG​ to be the radom variable returning the size of the set SSS output by the algorithm.

For integers k,nk,nk,n define: Xn,k=max⁡GE[XG], X_{n,k}=\max_G E[X_G], Xn,k​=Gmax​E[XG​],

where the max⁡\maxmax is taken over all graphs with ⩽n\leqslant n⩽n vertices2 and vertex cover of size ⩽k\leqslant k⩽k.

Now let’s analyze the number Xn,kX_{n,k}Xn,k​. Let G⋆G^\starG⋆ be the “worst-case graph” that bears witness to the max⁡\maxmax in the definition of Xn,kX_{n,k}Xn,k​. Run the first step of ALG on G⋆G^\starG⋆. Suppose we choose to pick s{\color{indianred}s}s in this step. Xn,k=E[XG⋆]=1+(12+ε)E[XG⋆−s∣s∈OPT]+(12−ε)E[XG⋆−s∣s∉OPT]=1+(12+ε)Xn,k−1+(12−ε)Xn−1,k⩽1+(12+ε)Xn,k−1+(12−ε)Xn,k=1+12Xn,k−1+ε⋅Xn,k−1+12Xn,k−εXn,k⩽1+12Xn,k−1+ε⋅Xn,k+12Xn,k−εXn,k=1+12Xn,k−1+ε⋅Xn,k+12Xn,k−εXn,k=1+12Xn,k−1+12Xn,k \begin{aligned} X_{n,k}=E[X_{G^\star}] & = {\color{indianred}1}+\left(\frac{1}{2}+\varepsilon \right) E\left[{\color{darkseagreen}X_{G^\star-s} \mid s \in \text{OPT}}\right]+\left(\frac{1}{2} - \varepsilon\right) E\left[{\color{palevioletred}X_{G^\star-s} \mid s \notin \text {OPT}}\right] \\ & = 1 + \left(\frac{1}{2} + \varepsilon \right){\color{darkseagreen}X_{n, k-1}}+ \left(\frac{1}{2} - \varepsilon \right){\color{palevioletred}X_{n-1, k}}\\ & \leqslant 1 + \left(\frac{1}{2} + \varepsilon \right){\color{darkseagreen}X_{n, k-1}}+ \left(\frac{1}{2} - \varepsilon \right){\color{dodgerblue}X_{n, k}}\\ & = 1 + \frac{1}{2} X_{n, k-1} + \varepsilon \cdot X_{n, k-1} + \frac{1}{2} X_{n, k} - \varepsilon X_{n, k}\\ & \leqslant 1 + \frac{1}{2} X_{n, k-1} + \varepsilon \cdot {\color{dodgerblue}X_{n, k}} + \frac{1}{2} X_{n, k} - \varepsilon X_{n, k}\\ & = 1 + \frac{1}{2} X_{n, k-1} + {\color{indianred}\varepsilon \cdot X_{n, k}} + \frac{1}{2} X_{n, k} - {\color{indianred}\varepsilon X_{n, k}}\\ & = 1 + \frac{1}{2} X_{n, k-1} + \frac{1}{2} X_{n, k} \end{aligned} Xn,k​=E[XG⋆​]​=1+(21​+ε)E[XG⋆−s​∣s∈OPT]+(21​−ε)E[XG⋆−s​∣s∈/OPT]=1+(21​+ε)Xn,k−1​+(21​−ε)Xn−1,k​⩽1+(21​+ε)Xn,k−1​+(21​−ε)Xn,k​=1+21​Xn,k−1​+ε⋅Xn,k−1​+21​Xn,k​−εXn,k​⩽1+21​Xn,k−1​+ε⋅Xn,k​+21​Xn,k​−εXn,k​=1+21​Xn,k−1​+ε⋅Xn,k​+21​Xn,k​−εXn,k​=1+21​Xn,k−1​+21​Xn,k​​

Note that:

  • Xn,k⩾Xn−1,kX_{n,k} \geqslant X_{n-1,k}Xn,k​⩾Xn−1,k​ and Xn,k⩾Xn,k−1X_{n,k} \geqslant X_{n,k-1}Xn,k​⩾Xn,k−1​.
  • Pr⁡[s∈OPT]⩾12\operatorname{Pr}[s \in \text{OPT}] \geqslant \frac{1}{2}Pr[s∈OPT]⩾21​, in particular we let Pr⁡[s∈OPT]=12+ε\operatorname{Pr}[s \in \text{OPT}] = \frac{1}{2} + \varepsilonPr[s∈OPT]=21​+ε.
  • Pr⁡[s∉OPT]=1−Pr⁡[s∈OPT]=12−ε\operatorname{Pr}[s \notin \text{OPT}] = 1 - \operatorname{Pr}[s \in \text{OPT}] = \frac{1}{2} - \varepsilonPr[s∈/OPT]=1−Pr[s∈OPT]=21​−ε.
  • G⋆−s{\color{darkseagreen}G^\star-s}G⋆−s is a graph on at most n{\color{darkseagreen}n}n vertices with a vertex cover of size ⩽k−1{\color{darkseagreen}\leqslant k-1}⩽k−1
  • G⋆−s{\color{palevioletred}G^\star-s}G⋆−s is a graph on at most n{\color{palevioletred}n}n vertices with a vertex cover of size ⩽k{\color{palevioletred}\leqslant k}⩽k

Rearranging terms, we get:

12Xn,k⩽1+12Xn,k−1≡Xn,k⩽2+Xn,k−1\frac{1}{2} X_{n,k} \leqslant 1 + \frac{1}{2} X_{n,k-1} \equiv X_{n,k} \leqslant 2 + X_{n,k-1}21​Xn,k​⩽1+21​Xn,k−1​≡Xn,k​⩽2+Xn,k−1​

Expanding the recurrence, we have: Xn,k⩽2kX_{n,k} \leqslant 2kXn,k​⩽2k, as claimed earlier.

Feedback Vertex Set

Now we turn to a problem similar to vertex cover, except that we are “killing cycles” instead of “killing edges”.

Feedback Vertex Set

Input: A (multi-)3graph G=(V,E)G = (V,E)G=(V,E).

Task: Find S⊆V(G)S \subseteq V(G)S⊆V(G) such that G∖SG \setminus SG∖S is a forest4, and minimize ∣S∣|S|∣S∣.

If we try to mimic the cute algorithm from before, we might easily be in trouble: note that the driving observation — that an edge has at least one of its endpoints in the solution with a reasonable enough probability — can fail spectacularly for FVS:

An example showing that for “most edges”, both endpoints do not belong to an optimal solution.

One thing about this example is the large number of pendant vertices sticking out prominently, and these clearly contribute to the badness of the situation. Happily, it turns out that we can get rid of these:

Lemma 1. Delete pendant and isolated vertices

Let GGG be a multi-graph and vvv be a vertex of degree ⩽1\leqslant 1⩽1. Then:

  • MinFVS of G−{v}G-\{v\}G−{v} ⩽\leqslant⩽ MinFVS of GGG

  • ∀S⊆V(G)−{v}\forall S \subseteq V(G)-\{v\}∀S⊆V(G)−{v}: SSS is an FVS for GGG ↔\leftrightarrow↔ SSS is an FVS for G∖{v}G \setminus \{v\}G∖{v}

Consider graphs with no pendant vertices and fix an optimal FVS SSS. Is it true that a reasonable fraction of edges are guaranteed to be incident to SSS? Well… not yet:

Spoiler

An(other) example showing that for “most edges”, both endpoints do not belong to an optimal solution, even though the graph has no pendant vertices.

However, continuing our approach of conquering-by-observing-patterns-in-counterexamples, note that the example above has an abundance of vertices that have degree two. Can we get rid of them? Well, isolated and pendant vertices were relatively easy because they don’t even belong to cycles, but that is not quite true for vertices of degree two. Can we still hope to shake them off?

One thing about a degree two vertex uuu is that if there is a cycle that contains uuu it must contain both its neighbors5. So you might suggest that we can ditch uuu and just work with its neighbors instead. This intuition, it turns out, can indeed be formalized:

Lemma 2. Short-Circuiting Degree Two Vertices

Let:

  • GGG be a multi-graph,
  • uuu be a vertex of degree 2 that is not a self-loop,
  • aaa and bbb be the neighbors of uuu (a=ba=ba=b is possible).

Let HHH be the graph obtained by adding an edge (a,b)(a,b)(a,b) to G−{u}G-\{u\}G−{u}.

Then:

  • every FVS SSS of GGG such that u∉Su \notin Su∈/S is an FVS of HHH, and
  • every FVS SSS of HHH is an FVS of GGG.

Illustrating Lemma 2 scenarios.

Let us also get rid of self-loops (because we can):

Lemma 3. Removing self-loops

If GGG has a vertex vvv with a self loop then

  • Every FVS SSS of GGG contains vvv
  • For every SSS containing vvv: SSS is an FVS of GGG ↔\leftrightarrow↔ S−vS-vS−v is an FVS of G−{v}G-\{v\}G−{v}

Now let’s apply Lemmas 1—3 exhaustively, which is to say we keep applying them until none of them are applicable (as opposed to applying them until we feel exhausted ). Once we are truly stuck, we have a graph HHH that is: (a) a graph whose minimum degree is three; and (b) equivalent to the original GGG in the sense that any minimum FVS for HHH can be extended to a minimum FVS of GGG by some time travel: just play back the applications of Lemmas 1—3 in reverse order.

Recall that all this work was to serve our hope for having a cute algorithm for FVS as well. Let’s check in on how we are doing on that front: consider graphs whose minimum degree is three and fix an optimal FVS SSS. Is it true that a reasonable fraction of edges are guaranteed to be incident to SSS? Or can we come up with examples to demonstrate otherwise?

This is a good place to pause and ponder: play around with examples to see if you can come up with bad cases as before. If you find yourself struggling, it would be for a good reason: we actually now do have the property we were after! Here’s the main claim that we want to make.

Key Lemma

Let:

  • GGG be a multigraph with no self loops and minimum degree ⩾3\geqslant 3⩾3,
  • SSS be an FVS of GGG,
  • (u,v)(u,v)(u,v) be a random edge in E(G)E(G)E(G).

Then:

Pr⁡[{u,v}∩S≠∅]⩾1/2\operatorname{Pr}[{\color{indianred}\{u, v\} \cap S \neq \varnothing}] \geqslant 1/2Pr[{u,v}∩S=∅]⩾1/2

We argue this as follows: call an edge good if it has at least one of its endpoints in SSS, and bad otherwise.

We will demonstrate that the number of good edges is at least the number of bad edges: this implies the desired claim.

  • The bad edges. Let X:=G∖SX := G \setminus SX:=G∖S. The bad edges are precisely E(G[X])E(G[X])E(G[X]).

  • The good edges. Every edge that has one of its endpoints in XXX and the other in SSS is a good edge. Recall that GGG has minimum degree three, because of which:

    • for every leaf in G[X]G[X]G[X], we have at least two good edges, and
    • for vertex that is degree two in G[X]G[X]G[X], we have at least one good edge.

So at this point, it is enough to show that twice the number of leaves and degree two vertices is at least ∣E(G[X])∣=∣X∣−1|E(G[X])| = |X|-1∣E(G[X])∣=∣X∣−1. But this is quite intuitive if we simple stare at the following mildly stronger claim:

2⋅(# leaves)+# deg-2vertices⩾∣X∣2 \cdot (\text{\# leaves}) + \text{\# deg-} 2 \text{vertices} \geqslant |X|2⋅(# leaves)+# deg-2vertices⩾∣X∣

which is equivalent to:

2⋅(# leaves)+# deg-2vertices⩾(# leaves)+# deg-2 vertices+# deg-(⩾3) vertices.2 \cdot ({\color{darkseagreen}\text{\# leaves}}) + {\color{palevioletred}\text{\# deg-}2 \text{vertices}} \geqslant ({\color{darkseagreen}\text{\# leaves}}) + {\color{palevioletred}\text{\# deg-}2 \text{ vertices}} + \text{\# deg-}(\geqslant 3) \text{ vertices}.2⋅(# leaves)+# deg-2vertices⩾(# leaves)+# deg-2 vertices+# deg-(⩾3) vertices.

After cancelations, we have:

(# leaves)⩾# deg-(⩾3) vertices.(\text{\# leaves}) \geqslant \text{\# deg-}(\geqslant 3) \text{ vertices}.(# leaves)⩾# deg-(⩾3) vertices.

Note that this is true! Intuitively, the inequality is suggesting every branching vertex in a tree pays for at least one leaf — this can be formalized by induction on nnn.

Induction proof sketch

Denote the tree by GGG and remove a leaf uuu to obtain HHH. Apply the induction hypothesis on HHH.

  • If the neighbor of uuu in GGG is a degree two vertex, then the number of leaves and high degree vertices are the same in GGG and HHH, so the claim follows directly.
  • If the degree of the neighbor in uuu is three in GGG, then both quantities in the inequality for HHH increase by one when we transition from HHH to GGG.
  • In the only remaining case, the quantity on the left increases by one when we come to GGG, which bodes well for the inequality.

All this was leading up to cute randomized algorithm v2.0 — i.e, adapted for FVS as follows:

Cute randomized algorithm redux

ALG(G)(G)(G)

Preprocess:

  • if GGG is acyclic return ∅\varnothing∅
  • if ∃\exists∃ a self loop vvv RETURN (((ALG(G∖{v}))∪{v}(G \setminus \{v\})) \cup \{v\}(G∖{v}))∪{v}.
  • if ∃\exists∃ a degree one vertex vvv RETURN ALG(G−{v})(G-\{v\})(G−{v}).
  • if ∃\exists∃ a degree two vertex vvv RETURN ALG(G/{v})(G/\{v\})(G/{v}) (c.f. Lemma 2).

Mindeg-3 instance:

  • pick an edge (u,v)∈E(G)(u,v) \in E(G)(u,v)∈E(G) u.a.r.
  • pick s∈{u,v}s \in \{u,v\}s∈{u,v} u.a.r.
  • RETURN (((ALG(G∖{s}))∪{s}(G \setminus \{s\})) \cup \{s\}(G∖{s}))∪{s}
Claim 1

ALG always returns a FVS of GGG.

This follows from Lemmas 1—3 and induction on nnn.

Claim 2

If GGG has a FVS of size kkk, then Pr⁡\operatorname{Pr}Pr[ALG returns an optimal FVS] ⩾1/4k\geqslant 1/4^k⩾1/4k.

This follows from Lemmas 1—3, the key lemma, and induction on nnn.

Exact Algorithms

Coming Soon.

Footnotes

  1. (even linear)↩︎

  2. We could have also considered Xk=max⁡GE[XG]X_k = \max_G E[X_G]Xk​=maxG​E[XG​], where the max is over all graphs whose vertex cover is at most kkk: but there are infinitely many graphs that have vertex covers of size at most kkk, and it is not immediate that the max is well-defined, so we restrict ourselves to graphs on nnn vertices that have vertex covers of size at most kkk.↩︎

  3. We allow for more than one edge between a fixed pair of vertices and self-loops.↩︎

  4. A graph without cycles that is not necessarily connected.↩︎

  5. Except when the cycle only contains uuu, i.e, uuu has a self-loop.↩︎


© 2022 • Neeldhara Misra • Credits •

 

Corrections? Please leave a comment here or a PR in this repository, thanks!

I’d rather be a failure at something I love than a success at something I hate.

George Burns

You live and you learn — at any rate, you live.

Douglas Adams

A problem worthy of attack proves its worth by fighting back.

Paul Erdos

×