In an undirected graph
, if
is a set of vertices and
is an edge, we say that
covers
if at least one endpoint of
belongs to
. We say that
is a vertex cover if it covers every edge. In the weighted vertex cover problem, one is given an undirected graph
and a weight
for each vertex
, and one must find a vertex cover of minimum combined weight.
We can express the weighted vertex cover problem as an integer program, by using decision variables for all
that encode whether
. For any set
we can define a vector
, with components indexed by vertices of
, by specifying that,
(8.1) |
is a vertex cover if and only if the constraint
is satisfied for every edge
. Conversely, if
satisfies
for every edge
then the set
is a vertex cover. Thus, the weighted vertex cover problem can be expressed as the following integer program.
To design an approximation algorithm for weighted vertex cover, we will transform this integer program into a linear program by relaxing the constraint
to allow the variables
to take fractional values.
It may seem more natural to replace the constraint
with
rather than
, but the point is that an optimal solution of the linear program will never assign any of the variables
a value strictly greater than
, because the value of any such variable could always be reduced to
without violating any constraints, and this would only improve the objective function
. Thus, writing the constraint as
rather than
is without loss of generality.
It is instructive to present an example of a fractional solution of equation () that achieves a strictly lower weight than any integer solution. One such example is when
is a 3-cycle with vertices
, each having weight
. Then the vector
satisfies all of the constraints of (
) and the objective function evaluates to
at
. In contrast, the minimum weight of a vertex cover of the 3-cycle is
.
We can solve the linear program () in polynomial time, but as we have just seen, the solution may be fractional. In that case, we need to figure out how we are going to post-process the fractional solution to obtain an actual vertex cover. In this case, the natural idea of rounding to the nearest integer works. Let
be an optimal solution of the linear program (
) and define:
Now let
. Note that
is a vertex cover because for every edge
the constraint
implies that at least one of
is greater than or equal to
.
Finally, we the analyze the approximation ratio of this algorithm. We observe that the rounding rule () has the property that for all
,
Let denote the vertex cover chosen by our
rounding algorithm, and let
denote the optimum vertex cover, we have
(8.3) |
where the final inequality holds because the fractional optimum of the linear program () must be less than or equal to the optimum of the integer program (
) because its feasible region is at least as big.