The set cover problem
Let a finite set \(U\) of \(n\) elements be given, together with a collection of its subsets \(\mathcal{S}=\left\{ S_{1}, \ldots , S_{k}\right\} \subset 2^U\). In particular, if \(\left|S_i\right| = 2, \; \forall i\), then \((U, \mathcal{S})\) is an undirected graph. A sub-collection \(\mathcal{S}^{\prime } \subseteq \mathcal{S}\) is called a cover if every element of \(U\) belongs to at least one member of \(\mathcal{S}^{\prime }\), i.e.,
\[ \bigcup _{S \in \mathcal{S}'}S = U \]
Minimum-cardinality set cover
A finite set \(U\) of \(n\) elements, a collection of its subsets \(\mathcal{S} \subset 2^U\).
A cover from \(\mathcal{S}\) of minimum cardinality.
The minimum-cardinality set cover problem
A universe \(U\) of 9 elements and a family \(\mathcal S=\{S_1,\dots,S_6\}\) of overlapping subsets. Hover over a set's label to highlight it and see its elements; hover over a point to see which sets it belongs to.
A generalization of this problem is the minimum-weight set cover problem. This is the version we will study.
Minimum-weight set cover
A finite set \(U\) of \(n\) elements, a collection of its subsets \(\mathcal{S} \subset 2^U\), and weights on the subsets \(c: \mathcal{S} \rightarrow \mathbf{Q}^{+}\).
A sub-collection of \(\mathcal{S}\) of minimum weight that covers the set \(U\).
The minimum-weight set cover problem
The same configuration \(U,\mathcal S\), but each set \(S_i\) now carries a weight \(c(S_i)\) (the number below its label). Hover over a set's label to highlight it.
1 A greedy algorithm for the set cover problem
In 1979 the Czech mathematician VΓ‘clav ChvΓ‘tal proposed a greedy algorithm for the set cover problem.
At each iteration we choose the most efficient set, remove the covered elements, and continue until every element is covered. Let \(C\) be the set of elements already covered in previous iterations. For each set \(S_{i}\) define its efficiency as \(\alpha_{i}=\frac{c\left(S_{i}\right)}{\left|S_{i} \setminus C\right|}\). The efficiency of a set equals the average cost at which the elements of that set not yet covered in previous iterations get covered. Call the price of an element the average cost at which it was covered. All newly covered elements of the set \(S_{i}\) receive the same price.
For a natural number \(n \in \mathbb {N}\) denote by
\[ H_n := 1 +\frac{1}{2}+\frac{1}{3}+\ldots +\frac{1}{n} \]
the partial sum of the harmonic series. Note that \(H_n = \ln n + \gamma + o(1)\), where \(\gamma \approx 0.577\) is the EulerβMascheroni constant; in particular, \(\ln n < H_n \leq \ln n + 1\).
A tight example for ChvΓ‘tal's algorithm
\(n\) singleton sets with weights \(\frac1n,\frac1{n-1},\dots,1\) sit inside a single set of weight \(1+\varepsilon\) containing all elements. At every iteration the greedy algorithm takes the set with least cost per uncovered element β and this is always the next singleton: its cost \(\frac1{n-i+1}\) is slightly less than the big set's cost, \(\frac{1+\varepsilon}{n-i+1}\). Step through the iterations with the buttons, or set \(n\).
Can one obtain a better algorithm? No: the set cover problem cannot be approximated within a factor of \((1 - o(1))\ln (n)\).
2 The minimum-weight vertex cover problem
2.1 Using a set-cover algorithm
Note that the minimum-weight vertex cover problem (in particular, the minimum-cardinality version) is a special case of the set cover problem. Indeed, let a graph \(G=(V, E)\) be given, and suppose we must find a vertex cover of minimum weight. We can build the following instance of the set cover problem:
Identify the universe \(U\) with the edge set \(E\), i.e., \(U = E\).
Each vertex \(v \in V\) corresponds to a set \(S_v \subseteq U\) consisting of all edges incident to \(v\).
The cost function is \(c: S_v \mapsto \text{the weight of vertex } v\).
Then any set cover \(S' \subseteq \{ S_v : v \in V\}\) covering \(U\) corresponds to a choice of vertices \(V' \subseteq V\) forming a vertex cover of the graph. Minimizing the total weight of the chosen sets \(S'\) is equivalent to minimizing the weight of the vertex cover.
Note that the greedy algorithm for the minimum-cardinality vertex cover problem is a special case of ChvΓ‘talβs algorithm. We thus obtain its accuracy bound: \(H_{\tilde{n}}\), where \(\tilde{n}\) is the maximum vertex degree in \(G\).
2.2 Constant-factor algorithms via weight splitting
In the introduction we obtained an algorithm for the minimum-cardinality vertex cover problem with a fixed accuracy bound of \(2\). Will it achieve the same accuracy for the more general problem, i.e., the minimum-weight cover problem? No!
A minimum-weight cover does not reduce to a minimum-cardinality cover
The same graph on 7 vertices: first without weights, with its minimum-cardinality cover, then with vertex weights β and a cover of smaller weight but larger cardinality. Hover over a vertex to see its weight.
2.2.1 The local ratio algorithm
The idea of the local ratio algorithm: splitting \(w=w_1+w_2\)
We choose an edge \(\{v,v'\}\) incident to the cheapest vertex and subtract \(c=\min(w(v),w(v'))\) from both of its endpoints: \(w_1\) is concentrated on these two vertices (\(c\) at each, zero elsewhere), and \(w_2=w-w_1\) is the same graph with reduced weights. Any cover of the graph \((V,E,w_1)\) is a 2-approximation: at least one of the edge's two endpoints must be covered. Hover over a vertex to track its weight across all three panels.
A full run of the local ratio algorithm
At each step \(i\) the algorithm takes an edge incident to the cheapest of the still-nonzero vertices and subtracts \(c\) from both of its endpoints β the weight \(t_i\) is concentrated on these two vertices. After 5 steps, the residual \(t_6\) marks the outlined vertices β this is the algorithm's solution. Hover over a vertex to see its residual weight.
2.2.2 The level algorithm
A second way to split the weights: do it globally rather than edge by edge.
Call a function \(w: V \to \mathbb {Q}_+\) of vertex weights degree-proportional if there exists a constant \(c>0\) such that the weight of every vertex \(v \in V\) equals \(w(v) = c \cdot \operatorname {deg}(v)\).
The level algorithm: another way to split the weights
A global subtraction proportional to vertex degree: \(c=\min_v w(v)/\deg(v)=3.5\) (attained at vertex \(ML\), \(\deg=4\)), so \(w_1(v)=c\cdot\deg(v)\) for every vertex, and \(w_2=w-w_1\) is the residual function (the residual at \(ML\) equals \(0\)). Hover over a vertex to see its degree and all three weights.
Let \(w: V \rightarrow \mathbf{Q}^{+}\) be an arbitrary function. Define the largest degree-proportional function relative to \(w\) in the graph \(G\) as follows:
Remove from the graph all vertices of degree 0;
Among the remaining vertices, compute the value \(c=\min \left\{ \frac{w(v)}{\operatorname {deg}(v)}\right\}\).
Then the function \(t(v)=c \cdot \operatorname {deg}(v)\) is the one sought.
Define \(w^{\prime }(v)=w(v)-t(v)\) as the residual weight function.
We now present an algorithm that splits the original weight function into degree-proportional functions and builds a vertex cover.
2.2.3 Accuracy bounds
Let us give an example on which this bound is achieved. Let \(K_{n, n}\) be a complete bipartite graph in which all vertices have unit weight. The level algorithm will place all \(2n\) vertices of \(K_{n, n}\) into the cover, whereas the optimal solution consists of the vertices of a single side.