There is a greedy algorithm for finding minimum vertex cover of a tree which uses DFS traversal.

  1. For each leaf of the tree, select its parent (i.e. its parent is in minimum vertex cover).
  2. For each internal node:
    if any of its children is not selected, then select this node.

How do I prove that this greedy strategy gives an optimal answer? That there is no vertex cover smaller in size than the one that the above algorithm produces?

  • I don't think the logic for the 2nd step is correct. If you consider a degenerate tree with 6 nodes going down all the way right (label them 1-6 corresponding to their depth). Then the first step of your algorithm will pick node 5. The second step will then possibly pick the first node (root) and then the second node (child) OR the third node. However, this is incorrect since you only want to pick node 2 and node 5 for a correct solution. – miguel.martin May 3 '16 at 3:32
  • @miguel.martin If the Vertex Cover just contains vertices numbered 2 and 5, the edge between node 3 and 4 won't be covered. – Laschet Jain Sep 9 '17 at 1:40

We first observe the following: There is an optimal cover $C$, and no leaf is in $C$. This is true since in any optimal cover $X$ you can replace all leaves in $X$ with their parents, and you get a vertex cover which is not larger than $X$.

Now take any optimal cover $C$ that does not contain leaves. Since no leave is selected, all parents of the leaves have to be in $C$. In other words, $C$ coincides with the greedy cover on the leaves and their parents. Next, we take out all edges that have been covered already. We can now apply the same argument again: In the remaining tree, no leaf needs to be selected, but then their parents have to be selected. And this is exactly what the greedy algorithm does. (A vertex becomes a leaf iff all of its children are selected in the previous step.) We repeat this argument we determined a complete vertex cover.

Hint: Construct a matching of the same size as your vertex cover by matching each vertex in the cover with an unselected child. Prove that $|M| \leq |C|$ for any matching $M$ and any vertex cover $C$. Conclude that the vertex cover is minimum and the matching is maximum.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.