The Nemhauser-Trotter LP Kernel
The linear programming relaxation of vertex cover was the starting point of Rounding the Vertex Cover LP, where it gave a 2-approximation. Here the same LP gives a kernel: a reduced instance with at most vertices. The tool is a structural theorem of Nemhauser and Trotter (1975), which says that the LP solution can be trusted wherever it is integral.
The LP and half-integrality
Its optimum is at most the minimum cover size , since every cover is a 0-1 solution. Every vertex of this polytope is half-integral: all values lie in (stated; see Integrality Gaps for the LP background). Given an optimal half-integral solution , split the vertices:
Theorem (Nemhauser and Trotter, 1975). There is a minimum vertex cover of with .
Proof sketch
is independent (an edge inside it would violate its constraint) and every neighbour of a 0-vertex has value 1. Let be any minimum cover and set . It is a cover: edges at end in , and no other edge lost an endpoint. It remains to show , that is, .
Suppose not. For a small lower by on and raise it by on . The objective drops by . Only edges at a lowered vertex need checking. Since , its neighbour is in , so was not lowered. If , then was raised and the sum stays . Otherwise and the sum is at least . The new solution is feasible and cheaper, contradicting optimality of .
The kernel
LP-KERNEL(G, k)
1 compute an optimal half-integral solution x; form V0, V_half, V1
2 if LP(G) > k: return a trivial NO instance
3 return (G[V_half], k - |V1|)Theorem. This is a kernel with at most vertices.
Proof. By Nemhauser-Trotter, has a cover of size iff has one of size : take and an optimal cover of the middle part. The restriction of to , all halves, is optimal for (otherwise itself could be improved), so . If the reduced instance is a YES instance, , so . Line 2 rejects instances where this fails.
The bound is tight for this method: on a disjoint union of triangles every vertex gets and nothing is removed.
Solving the LP by bipartite matching
No general LP solver is needed. Build the bipartite double cover : two copies of every vertex and, for every edge of , the two edges and . Find a minimum vertex cover of by König's theorem (Bipartite Matching and König's Theorem) and set
Every edge of gives two edges of , both covered, so ; and any LP solution doubled gives a fractional cover of , whose optimum equals the integral one because is bipartite. So is an optimal half-integral solution, computed in time with Hopcroft-Karp, or with simple augmenting paths as below. The program also checks the LP value against SciPy's linprog and the kernel against brute force.
import random
from itertools import combinations
from scipy.optimize import linprog
def half_integral_lp(n, edges):
adj = [[] for _ in range(n)] # left copy u -> right copies
for u, v in edges:
adj[u].append(v); adj[v].append(u)
mate_r = [-1] * n
def augment(u, seen):
for v in adj[u]:
if not seen[v]:
seen[v] = True
if mate_r[v] < 0 or augment(mate_r[v], seen):
mate_r[v] = u
return True
return False
for u in range(n):
augment(u, [False] * n)
matched_l = set(mate_r) - {-1}
reach_l, reach_r = {u for u in range(n) if u not in matched_l}, set()
stack = list(reach_l)
while stack:
u = stack.pop()
for v in adj[u]:
if v not in reach_r:
reach_r.add(v)
w = mate_r[v]
if w >= 0 and w not in reach_l:
reach_l.add(w); stack.append(w)
XL = set(range(n)) - reach_l # Koenig: (L minus reached) + (R reached)
return [((u in XL) + (u in reach_r)) / 2 for u in range(n)]
def opt(vs, edges):
for s in range(len(vs) + 1):
for S in combinations(vs, s):
if all(a in S or b in S for a, b in edges):
return s
rng = random.Random(2)
print(" n LP linprog |V0| |V1/2| |V1| OPT OPT(kernel)+|V1|")
for trial in range(5):
n = 16
E = [(a, b) for a, b in combinations(range(n), 2) if rng.random() < 0.18]
x = half_integral_lp(n, E)
lp = linprog([1] * n, A_ub=[[-(i in e) for i in range(n)] for e in E], b_ub=[-1] * len(E), bounds=(0, None)).fun
V0 = [v for v in range(n) if x[v] == 0]
Vh = [v for v in range(n) if x[v] == 0.5]
V1 = [v for v in range(n) if x[v] == 1]
kernel_edges = [(a, b) for a, b in E if a in Vh and b in Vh]
print(f"{n:3} {sum(x):5} {lp:7.1f} {len(V0):5} {len(Vh):5} {len(V1):4} {opt(list(range(n)), E):5}"
f" {opt(Vh, kernel_edges) + len(V1):10}") n LP linprog |V0| |V1/2| |V1| OPT OPT(kernel)+|V1|
16 8.0 8.0 0 16 0 9 9
16 8.0 8.0 0 16 0 9 9
16 6.5 6.5 3 13 0 7 7
16 7.0 7.0 3 12 1 7 7
16 7.0 7.0 9 0 7 7 7
The two LP values agree, and the last two columns agree on every instance: the vertices fixed to 1 are in a minimum cover and those fixed to 0 are not needed. The kernel is . Dense random graphs often give the all-halves solution, and then the kernel is the whole graph, still within the bound because is required for a YES answer.
In C++
The kernel on a larger graph: a sparse random graph plus pendant vertices attached to a few hubs. The pendants get value 0 and the hubs value 1, so they leave the instance, and in this run the LP settles most of the sparse core as well. What is left is the part where the LP is undecided.
#include <cstdio>
#include <functional>
#include <vector>
int main() {
const int core = 30, pend = 170, n = core + pend;
std::vector<std::vector<int>> adj(n);
unsigned s = 21;
auto rnd = [&](int m) { s = s * 1103515245u + 12345u; return int((s >> 8) % m); };
for (int a = 0; a < core; a++)
for (int b = a + 1; b < core; b++)
if (rnd(100) < 12) { adj[a].push_back(b); adj[b].push_back(a); }
for (int p = core; p < n; p++) { // each pendant hangs on one of 6 hubs
int h = rnd(6);
adj[p].push_back(h); adj[h].push_back(p);
}
std::vector<int> mate(n, -1);
std::vector<char> seen;
std::function<bool(int)> augment = [&](int u) {
for (int v : adj[u])
if (!seen[v]) {
seen[v] = 1;
if (mate[v] < 0 || augment(mate[v])) { mate[v] = u; return true; }
}
return false;
};
int matching = 0;
for (int u = 0; u < n; u++) { seen.assign(n, 0); matching += augment(u); }
std::vector<char> matchedL(n, 0), rL(n, 0), rR(n, 0);
for (int v = 0; v < n; v++) if (mate[v] >= 0) matchedL[mate[v]] = 1;
std::vector<int> st;
for (int u = 0; u < n; u++) if (!matchedL[u]) { rL[u] = 1; st.push_back(u); }
while (!st.empty()) {
int u = st.back(); st.pop_back();
for (int v : adj[u])
if (!rR[v]) { rR[v] = 1; int w = mate[v]; if (w >= 0 && !rL[w]) { rL[w] = 1; st.push_back(w); } }
}
int cnt[3] = {0, 0, 0};
for (int v = 0; v < n; v++) cnt[(!rL[v]) + rR[v]]++; // 2 x_v = [v_L in X] + [v_R in X]
std::printf("n = %d, double-cover matching = %d, LP value = %.1f\n", n, matching, matching / 2.0);
std::printf("|V0| = %d, |V1/2| = %d, |V1| = %d\n", cnt[0], cnt[1], cnt[2]);
std::printf("kernel: %d vertices, k reduced by %d\n", cnt[1], cnt[2]);
}n = 200, double-cover matching = 32, LP value = 16.0
|V0| = 183, |V1/2| = 2, |V1| = 15
kernel: 2 vertices, k reduced by 15
Where the LP kernel stands
- In terms of vertices, is essentially the best kernel known for vertex cover. Slightly smaller ones, such as vertices for any constant (Lampis, 2011), exist; a kernel with vertices for a constant is not known.
- The kernel can have edges, and edges is impossible unless coNP NP/poly (Dell and van Melkebeek, 2010).
- The LP view gives FPT algorithms above the LP bound: deciding whether a cover of size at most exists is FPT in (Cygan, Pilipczuk, Pilipczuk and Wojtaszczyk, 2013; Lokshtanov, Narayanaswamy, Raman, Ramanujan and Saurabh, 2014). This parameter can be far smaller than .
- The algorithm of Chen, Kanj and Xia (2010) with running time first reduces to a kernel of this kind and then branches.
Test yourself
What does the Nemhauser-Trotter theorem say about an optimal half-integral LP solution ?
- is always empty
- Some minimum cover contains all of and none of
- is always integral
- The minimum cover equals
Why does the reduced instance have at most vertices when the answer is YES?
- Because every vertex has degree 2
- Because its LP optimum is , and an LP optimum is at most the cover size
- Because is independent
- Because of Buss's rule
How does the bipartite double cover give a half-integral LP solution?
- Its maximum matching is the vertex cover
- A minimum vertex cover of the double cover gives , which is feasible and optimal
- It rounds the LP solution
- It doubles the number of edges and removes half
On which graph does the LP kernel remove nothing?
- A star
- A disjoint union of triangles
- A path with two vertices
- A graph with an isolated vertex