Crown Decompositions
Buss's kernel leaves up to vertices. A linear kernel needs a rule that can remove many low-degree vertices at once, and the degree-1 rule of Bounded Search Trees for Vertex Cover points the way: a pendant vertex with neighbour lets us take for free. A crown is the same picture with many pendant-like vertices and many ""s at once.
Definition
A crown decomposition of a graph is a partition of its vertices into three sets , , such that
- (the crown) is a nonempty independent set;
- (the head) separates from : there are no edges between and ;
- there is a matching between and that saturates : every vertex of is matched to its own vertex of .
C: o o o o o independent, all neighbours in H
| /| | /
H: # # # each head vertex matched into C (the | edges)
|\ | /|
R: rest of the graph no edges between C and RCrown rule. If is a crown decomposition, replace by .
Safety. Some minimum cover contains and nothing from . The matching gives disjoint edges inside , so every cover uses at least vertices of . On the other hand alone covers every edge touching (edges at go to , since is independent and ). So replacing a cover's part in by never makes it larger, and what remains to cover is exactly the graph .
The degree-1 rule is the special case , .
Finding a crown: the crown lemma
Crown lemma. Let have no isolated vertices and at least vertices. Then in polynomial time one can find either a matching with more than edges (so the answer is NO) or a crown decomposition.
Proof (constructive). Find a maximal matching greedily. If , answer NO. Otherwise , the matched vertices, has at most vertices, and the rest is independent (an edge inside could extend ) with at least vertices. Consider the bipartite graph between and formed by the edges of between them. Compute a maximum matching of and, by König's theorem (Bipartite Matching and König's Theorem), a minimum vertex cover of with .
- If , answer NO.
- Otherwise , so is nonempty. Every edge of at is covered by at its other end, so ; let . Each vertex of is matched by and each edge of has exactly one endpoint in , so each is matched to a vertex of . That matching saturates . And has neighbours because has no isolated vertices, so .
Theorem. Vertex cover has a kernel with at most vertices: apply the isolated-vertex rule and the crown rule until the graph has at most vertices or the lemma reports NO.
Each application removes at least one vertex, so there are at most rounds, each polynomial (Chor, Fellows and Juedes, 2004; Abu-Khzam, Fellows, Langston and Suters, 2007).
Implementation
The program finds crowns as in the proof: a greedy maximal matching, then Kuhn's augmenting paths for the bipartite matching , then König's construction of (vertices of not reachable from free -vertices by alternating paths, plus the reachable ones of ).
import random
from itertools import combinations
def maximal_matching(adj):
matched = set()
for u in sorted(adj):
for v in sorted(adj[u]):
if u not in matched and v not in matched:
matched |= {u, v}
return matched
def bipartite_cover(I, adj):
mate = {} # vertex of V(M) -> its partner in I
def augment(u, seen):
for v in sorted(adj[u]):
if v not in seen:
seen.add(v)
if v not in mate or augment(mate[v], seen):
mate[v] = u
return True
return False
for u in sorted(I):
augment(u, set())
matched_I = set(mate.values())
reach_I, reach_M = {u for u in I if u not in matched_I}, set()
stack = list(reach_I)
while stack: # alternating paths from free I-vertices
u = stack.pop()
for v in adj[u]:
if v not in reach_M:
reach_M.add(v)
w = mate.get(v)
if w is not None and w not in reach_I:
reach_I.add(w); stack.append(w)
return len(mate), (set(I) - reach_I) | reach_M # Koenig: a minimum vertex cover
def find_crown(adj, k):
VM = maximal_matching(adj)
if len(VM) // 2 > k:
return "NO"
I = set(adj) - VM
size, X = bipartite_cover(I, adj)
if size > k:
return "NO"
C = I - X
H = {v for c in C for v in adj[c]}
return (C, H) if C else None
def crown_kernel(adj, k, log):
adj = {v: set(nb) for v, nb in adj.items()}
while True:
adj = {v: nb for v, nb in adj.items() if nb} # drop isolated vertices
if len(adj) <= 3 * k:
return adj, k
r = find_crown(adj, k)
if r == "NO" or r is None:
return None, k
C, H = r
log.append((len(C), len(H)))
gone = C | H
adj = {v: nb - gone for v, nb in adj.items() if v not in gone}
k -= len(H)
def opt(adj):
V = sorted(adj)
E = [(a, b) for a in V for b in adj[a] if a < b]
for s in range(len(V) + 1):
for S in combinations(V, s):
if all(a in S or b in S for a, b in E):
return s
rng = random.Random(4)
for trial in range(4):
n = 24
adj = {v: set() for v in range(n)}
hubs = rng.sample(range(n), rng.randint(3, 5)) # a small cover plus a few extra edges
for v in range(n):
for h in rng.sample(hubs, 2):
if v != h:
adj[v].add(h); adj[h].add(v)
for _ in range(rng.randint(2, 4)):
a, b = rng.sample(range(n), 2)
adj[a].add(b); adj[b].add(a)
o = opt(adj)
log = []
K, k2 = crown_kernel(adj, o, log)
ko = opt(K) if K is not None else None
print(f"n = {n}, OPT = {o}: crowns (|C|,|H|) {log} -> kernel {len(K)} vertices, k' = {k2}, OPT(kernel) = {ko}")n = 24, OPT = 5: crowns (|C|,|H|) [(14, 3)] -> kernel 4 vertices, k' = 2, OPT(kernel) = 2
n = 24, OPT = 5: crowns (|C|,|H|) [(14, 3)] -> kernel 4 vertices, k' = 2, OPT(kernel) = 2
n = 24, OPT = 6: crowns (|C|,|H|) [(13, 4)] -> kernel 5 vertices, k' = 2, OPT(kernel) = 2
n = 24, OPT = 6: crowns (|C|,|H|) [(12, 4)] -> kernel 4 vertices, k' = 2, OPT(kernel) = 2
Every kernel has at most vertices, and in every case , which is the safety of the rule checked by brute force.
In C++
The crown search in C++ on a graph with 40 vertices and a planted cover of size 5. It prints the maximal matching size, the bipartite matching size, and the crown found.
#include <cstdio>
#include <functional>
#include <set>
#include <vector>
int main() {
const int n = 40, k = 5;
std::vector<std::set<int>> adj(n);
unsigned s = 8;
auto rnd = [&](int m) { s = s * 1103515245u + 12345u; return int((s >> 8) % m); };
for (int v = k; v < n; v++) { // every edge touches the cover {0, ..., 4}
int h = rnd(k);
adj[v].insert(h); adj[h].insert(v);
}
adj[0].insert(1); adj[1].insert(0);
std::vector<bool> inM(n, false);
int msize = 0;
for (int u = 0; u < n; u++)
for (int v : adj[u])
if (!inM[u] && !inM[v]) { inM[u] = inM[v] = true; msize++; }
std::printf("maximal matching: %d edges\n", msize);
std::vector<int> mate(n, -1); // mate[v] for v in V(M): its partner in I
std::vector<bool> seen;
std::function<bool(int)> augment = [&](int u) {
for (int v : adj[u])
if (inM[v] && !seen[v]) {
seen[v] = true;
if (mate[v] < 0 || augment(mate[v])) { mate[v] = u; return true; }
}
return false;
};
int bsize = 0;
std::vector<bool> matchedI(n, false);
for (int u = 0; u < n; u++)
if (!inM[u]) { seen.assign(n, false); if (augment(u)) bsize++; }
for (int v = 0; v < n; v++) if (mate[v] >= 0) matchedI[mate[v]] = true;
std::printf("bipartite matching I - V(M): %d edges\n", bsize);
std::vector<bool> rI(n, false), rM(n, false);
std::vector<int> st;
for (int u = 0; u < n; u++) if (!inM[u] && !matchedI[u]) { rI[u] = true; st.push_back(u); }
while (!st.empty()) {
int u = st.back(); st.pop_back();
for (int v : adj[u])
if (inM[v] && !rM[v]) {
rM[v] = true;
int w = mate[v];
if (w >= 0 && !rI[w]) { rI[w] = true; st.push_back(w); }
}
}
std::set<int> C, H;
for (int u = 0; u < n; u++) if (!inM[u] && rI[u]) C.insert(u); // I minus the cover X
for (int c : C) for (int v : adj[c]) H.insert(v);
std::printf("crown |C| = %zu, head H =", C.size());
for (int h : H) std::printf(" %d", h);
std::printf("\nremove C and H, k drops from %d to %d\n", k, k - (int)H.size());
}maximal matching: 4 edges
bipartite matching I - V(M): 5 edges
crown |C| = 32, head H = 0 1 2 3 4
remove C and H, k drops from 5 to 0
Crowns and linear programming
The crown rule is closely tied to the LP relaxation of vertex cover. An optimal half-integral LP solution (values , , ) has its 0-vertices independent with all neighbours at value 1, and that pair of sets behaves like a crown. The next lesson, The Nemhauser-Trotter LP Kernel, uses this to get a kernel with vertices. Whether vertex cover has a kernel with vertices is open; a kernel with edges is ruled out unless coNP NP/poly (Dell and van Melkebeek, 2010).
Test yourself
Which condition is NOT part of a crown decomposition ?
- is independent
- There are no edges between and
- There is a matching from into saturating
- is independent
Why is taking all of into the cover safe?
- Because has the highest degrees
- Because the matching forces at least cover vertices in , and alone covers every edge touching
- Because is empty
- Because is independent
What does the crown lemma guarantee for a graph without isolated vertices and with at least vertices?
- A cover of size
- Either a matching with more than edges, so the answer is NO, or a crown decomposition found in polynomial time
- A clique of size
- A kernel with edges