TExcelTAD
Home › Parameterized & Fine-Grained Complexity › The Nemhauser-Trotter LP Kernel

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 2k2k 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

minimize∑v∈Vxvsubject toxu+xv≥1for every edge uv,xv≥0for every vertex v.\begin{aligned} \text{minimize} \quad & \sum_{v \in V} x_v \\ \text{subject to} \quad & x_u + x_v \ge 1 && \text{for every edge } uv, \\ & x_v \ge 0 && \text{for every vertex } v. \end{aligned}

Its optimum LP(G)\text{LP}(G) is at most the minimum cover size OPT(G)\text{OPT}(G), since every cover is a 0-1 solution. Every vertex of this polytope is half-integral: all values lie in {0,12,1}\{0, \frac{1}{2}, 1\} (stated; see Integrality Gaps for the LP background). Given an optimal half-integral solution xx, split the vertices:

V0={v:xv=0},V1/2={v:xv=12},V1={v:xv=1}.V_0 = \{v : x_v = 0\}, \qquad V_{1/2} = \{v : x_v = \tfrac{1}{2}\}, \qquad V_1 = \{v : x_v = 1\}.

Theorem (Nemhauser and Trotter, 1975). There is a minimum vertex cover SS of GG with V1⊆S⊆V1∪V1/2V_1 \subseteq S \subseteq V_1 \cup V_{1/2}.

Proof sketch

V0V_0 is independent (an edge inside it would violate its constraint) and every neighbour of a 0-vertex has value 1. Let S∗S^* be any minimum cover and set S=(S∗∖V0)∪V1S = (S^* \setminus V_0) \cup V_1. It is a cover: edges at V0V_0 end in V1⊆SV_1 \subseteq S, and no other edge lost an endpoint. It remains to show ∣S∣≤∣S∗∣\lvert S \rvert \le \lvert S^* \rvert, that is, ∣V1∖S∗∣≤∣V0∩S∗∣\lvert V_1 \setminus S^* \rvert \le \lvert V_0 \cap S^* \rvert.

Suppose not. For a small ε>0\varepsilon > 0 lower xx by ε\varepsilon on V1∖S∗V_1 \setminus S^* and raise it by ε\varepsilon on V0∩S∗V_0 \cap S^*. The objective drops by ε(∣V1∖S∗∣−∣V0∩S∗∣)>0\varepsilon(\lvert V_1 \setminus S^* \rvert - \lvert V_0 \cap S^* \rvert) > 0. Only edges at a lowered vertex u∈V1∖S∗u \in V_1 \setminus S^* need checking. Since u∉S∗u \notin S^*, its neighbour vv is in S∗S^*, so vv was not lowered. If v∈V0v \in V_0, then v∈V0∩S∗v \in V_0 \cap S^* was raised and the sum stays 1−ε+ε=11 - \varepsilon + \varepsilon = 1. Otherwise xv≥12x_v \ge \frac{1}{2} and the sum is at least 32−ε≥1\frac{3}{2} - \varepsilon \ge 1. The new solution is feasible and cheaper, contradicting optimality of xx. □\square

The kernel

text
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 2k2k vertices.

Proof. By Nemhauser-Trotter, GG has a cover of size kk iff G[V1/2]G[V_{1/2}] has one of size k−∣V1∣k - \lvert V_1 \rvert: take V1V_1 and an optimal cover of the middle part. The restriction of xx to V1/2V_{1/2}, all halves, is optimal for G[V1/2]G[V_{1/2}] (otherwise xx itself could be improved), so LP(G[V1/2])=12∣V1/2∣\text{LP}(G[V_{1/2}]) = \frac{1}{2}\lvert V_{1/2} \rvert. If the reduced instance is a YES instance, 12∣V1/2∣≤OPT(G[V1/2])≤k−∣V1∣≤k\frac{1}{2}\lvert V_{1/2} \rvert \le \text{OPT}(G[V_{1/2}]) \le k - \lvert V_1 \rvert \le k, so ∣V1/2∣≤2k\lvert V_{1/2} \rvert \le 2k. Line 2 rejects instances where this fails. □\square

The bound is tight for this method: on a disjoint union of triangles every vertex gets 12\frac{1}{2} and nothing is removed.

Solving the LP by bipartite matching

No general LP solver is needed. Build the bipartite double cover BB: two copies vL,vRv_L, v_R of every vertex and, for every edge uvuv of GG, the two edges uLvRu_L v_R and vLuRv_L u_R. Find a minimum vertex cover XX of BB by König's theorem (Bipartite Matching and König's Theorem) and set

xv=12([vL∈X]+[vR∈X]).x_v = \tfrac{1}{2}\left( [v_L \in X] + [v_R \in X] \right).

Every edge uvuv of GG gives two edges of BB, both covered, so xu+xv≥1x_u + x_v \ge 1; and any LP solution doubled gives a fractional cover of BB, whose optimum equals the integral one because BB is bipartite. So xx is an optimal half-integral solution, computed in O(mn)O(m \sqrt{n}) time with Hopcroft-Karp, or O(nm)O(nm) with simple augmenting paths as below. The program also checks the LP value against SciPy's linprog and the kernel against brute force.

python · try it yourself
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 G[V1/2]G[V_{1/2}]. Dense random graphs often give the all-halves solution, and then the kernel is the whole graph, still within the 2k2k bound because LP=n2≤k\text{LP} = \frac{n}{2} \le k 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.

cpp · try it yourself
#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, 2k2k is essentially the best kernel known for vertex cover. Slightly smaller ones, such as 2k−clog⁡k2k - c \log k vertices for any constant cc (Lampis, 2011), exist; a kernel with (2−ε)k(2 - \varepsilon)k vertices for a constant ε>0\varepsilon > 0 is not known.
  • The kernel can have Θ(k2)\Theta(k^2) edges, and O(k2−ε)O(k^{2-\varepsilon}) edges is impossible unless coNP ⊆\subseteq 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 LP(G)+ℓ\text{LP}(G) + \ell exists is FPT in ℓ\ell (Cygan, Pilipczuk, Pilipczuk and Wojtaszczyk, 2013; Lokshtanov, Narayanaswamy, Raman, Ramanujan and Saurabh, 2014). This parameter can be far smaller than kk.
  • The algorithm of Chen, Kanj and Xia (2010) with running time O(1.2738k+kn)O(1.2738^k + kn) 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 xx?

  1. V1/2V_{1/2} is always empty
  2. Some minimum cover contains all of V1V_1 and none of V0V_0
  3. xx is always integral
  4. The minimum cover equals V1V_1

Why does the reduced instance G[V1/2]G[V_{1/2}] have at most 2k2k vertices when the answer is YES?

  1. Because every vertex has degree 2
  2. Because its LP optimum is 12∣V1/2∣\frac{1}{2}\lvert V_{1/2} \rvert, and an LP optimum is at most the cover size k′≤kk' \le k
  3. Because V0V_0 is independent
  4. Because of Buss's rule

How does the bipartite double cover give a half-integral LP solution?

  1. Its maximum matching is the vertex cover
  2. A minimum vertex cover XX of the double cover gives xv=12([vL∈X]+[vR∈X])x_v = \frac{1}{2}([v_L \in X] + [v_R \in X]), which is feasible and optimal
  3. It rounds the LP solution
  4. It doubles the number of edges and removes half

On which graph does the LP kernel remove nothing?

  1. A star
  2. A disjoint union of triangles
  3. A path with two vertices
  4. A graph with an isolated vertex