ZiliangZiliang

Site navigation

  • Mortgage comparison
  • Japan tax calculator
  • Programming
  • Algorithms
  • Machine learning
  • Misc
Engineering
Contact
中文

Site navigation

  • Mortgage comparison
  • Japan tax calculator
  • Programming
  • Algorithms
  • Machine learning
  • Misc
Engineering
Contact

Article directory

  • Programming Languages

    • Overview
    • Basics
    • Collections
    • Flow Control Statements
    • Function
    • Libraries and Modules
    • IO, File, and OS
    • Errors and Exceptions
    • Object-Oriented Design
    • Namespaces and Scopes
  • Data Structures and Algorithms

    • Overview
    • Math Formula
    • Math Code
    • Misc
    • String
    • Tree Traversal
    • Balanced Binary Trees
    • Heap
    • Segment Tree
    • Dynamic Programming
    • Tree Misc
    • Java
    • Disjoint Sets
    • Graph Traversal
    • Minimum Spanning Tree
    • Single-Source Shortest Paths
    • Strongly Connected Components
    • Cut Vertices and Bridges
    • Cache
    • Binary Search
    • Quicksort
    • Knapsack Problem
    • Vertex Cover Problem
    • Set Cover Problem
    • Principle Component Analysis
    • K-Center Problem

Vertex Cover Problem

In the mathematical discipline of graph theory, a vertex cover (sometimes node cover) of a graph is a set of vertices that includes at least one endpoint of every edge of the graph. The minimum vertex cover problem is the optimization problem of finding a smallest vertex cover in a given graph. In short, it is to find a minimum set of vertices to track all edges.

  • Input: Set V, Set E⊆{{u,v}|u,v∈V}
  • Output: Set S⊆V
  • Constraint: For all {u,v}∈E, either u∈S or v∈S
  • Objective Function: Minimize |S|

Suppose V={1,...,n}, we can express the output as a vector x→=(x1,...,xn)⊺, where xi=1 if i∈S, otherwise, xi=0

We introduce the Incidence Matrix A for this problem. Matrix A has the shape of |E|×|V|, each row represents a relationship (edge). In each row, two elements are 1, indicating that these two nodes are linked. Therefore, the above problem can be expressed as follows.

  • Input:
    • Matrix A
    • vector b→=(1,...,1)⊺
    • vector c→=(1,...,1)⊺
    • Assumption: At each row of A, two elements are 1, others are 0. All elements of b→ and c→ are 1.
  • Output: vector x→=(x1,...,xn)⊺, where xi is either 0 or 1.
  • Constraint: Ax→≥b→
  • Objective Function: Minimize c→⊺x→

Rounding

Fractional Vertex Cover

  • Input:
    • Matrix A
    • vector b→=(1,...,1)⊺
    • vector c→=(1,...,1)⊺
    • Assumption: At each row of A, two elements are 1, others are 0. All elements of b→ and c→ are 1.
  • Output: vector x→=(x1,...,xn)⊺, where xi∈[0,1].
  • Constraint: Ax→≥b→
  • Objective Function: Minimize c→⊺x→

Algorithm

The algorithm is based the fractional vertex cover problem we just defined.

  1. Use linear programming to solve fractional vertex cover, and get output vector x→=(x1,...,xn)⊺, where xi∈[0,1]
  2. For all 0≤i≤n, let xi′=1 when xi≥0.5, otherwise, xi′=0. Let x→′=(x1′,...,xn′)⊺.
  3. Return x→′ as the answer of the vertex cover problem.

Theorem

  1. x→′ is an answer for the vertex cover problem. It satisfies the constraint.
  2. It is a 2-approximation algorithm. For any particular input, SOL≤2 OPT.

Proof

Here we prove that the algorithm is a 2-approximation algorithm, i.e., SOL≤2 OPT for any input.

Let x→=(x1,...,xn)⊺ be the optimal solution for the fractional vertex cover problem. It is the vector in [0,1]n that minimizes c→⊺x→ when Ax→≥b→. On the other hand, let x→∗ be the vector in {0,1}n that minimizes c→⊺x→ when Ax→≥b→. Both of the vectors minimize the objective function with the same constraint, but x→ is selected from a larger set. x→ has more chances to minimize the objective function, so the objective value of x→ is better (thus smaller) than that of x→∗, i.e., c→⊺x→≤c→⊺x→∗.

Now, consider the value of xi′. By the rounding at the step 2 of the algorithm, we have xi′≤2xi. Then

SOL=c→⊺x→′=∑ixi′≤2∑ixi=2c→⊺x→≤2c→⊺x→∗=2 OPT
Edit this page on GitHub
Last Updated: 9/10/26, 7:37 AM
Contributors: Lucien
Prev
Knapsack Problem
Next
Set Cover Problem