Quiz 2

Parameterized Algorithms

744 words
4 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Parameterized Algorithms ## 🎯 Learning Objectives - Explain fixed-parameter tractability (FPT) - Design bounded search tree algorithms - Apply kernelization techniques - Understand the W-hierarchy - Identify FPT vs. W-hard problems * * * ## 1.

Parameterized Algorithms

🎯 Learning Objectives

  • Explain fixed-parameter tractability (FPT)
  • Design bounded search tree algorithms
  • Apply kernelization techniques
  • Understand the W-hierarchy
  • Identify FPT vs. W-hard problems

1. Parameterized Complexity

1.1 Intuition

Some NP-hard problems are "easy" when a parameter is small. For example, finding a vertex cover of size kk: brute force over C(n,k)C(n,k) subsets is O(nk)O(n^k), but with parameterized techniques it's O(2kn)O(2^k n) — exponential only in kk, not nn.

1.2 Definitions

ConceptMeaningExample
FPTO(f(k)nO(1))O(f(k) \cdot n^{O(1)})Vertex cover: O(2kn)O(2^k n)
XPO(nf(k))O(n^{f(k)})Clique: O(nk)O(n^k)
KernelReduction to size f(k)f(k)Vertex cover: O(k2)O(k^2) kernel
W[1]-hardUnlikely FPTClique, Independent Set

2. Vertex Cover (Bounded Search Tree)

2.1 Algorithm

python
def vertex_cover(G, k):
    if k < 0: return None
    if not G.edges(): return set()
    (u, v) = any edge in G
    # Branch: either u or v must be in the cover
    result1 = vertex_cover(G - {u}, k-1)
    if result1 is not None:
        return result1 ∪ {u}
    result2 = vertex_cover(G - {v}, k-1)
    if result2 is not None:
        return result2 ∪ {v}
    return None
Branching factor: 2, Depth: k, Time: O(2kn)O(2^k n)

2.2 Kernelization

Buss kernel: Remove isolated vertices, degree > k vertices must be in cover. Remaining graph has ≤ k2k^2 edges.
  1. Remove isolated vertices (degree 0)
  2. If any vertex has degree > k, include it in cover, decrease k
  3. If remaining graph has > k2k^2 edges, reject (more than k2k^2 edges needs > k vertices)
  4. Kernel size: O(k2)O(k^2)

3. Feedback Vertex Set (FVS)

3.1 Problem

Remove ≤ kk vertices to make graph acyclic.

3.2 FPT Algorithm

  • Branch on vertices in cycles
  • Use iterative compression technique
  • Running time: O(5knO(1))O(5^k n^{O(1)})

4. The W-Hierarchy

FPTW[1]W[2]...XPFPT \subseteq W[1] \subseteq W[2] \subseteq ... \subseteq XP
ProblemClassStatus
Vertex CoverFPTO(1.618k+n)O(1.618^k + n)
Feedback Vertex SetFPTO(5kn)O(5^k n)
k-Path (path of length k)FPTO(2O(k)n)O(2^{O(k)} n)
CliqueW[1]-completeFPT unlikely
Dominating SetW[2]-completeFPT unlikely

5. Common Pitfalls

Pitfall: Confusing XP with FPT

The mistake: Thinking O(nk)O(n^k) (XP) is FPT. Correct approach: FPT requires kk only in the exponent's base (O(f(k)n)O(f(k)n)), not in the exponent of nn (O(nk)O(n^k)). For k=10k=10, FPT = O(210n)=O(1024n)O(2^{10}n) = O(1024n), XP = O(n10)O(n^{10}).

6. Key Concepts Reference

TechniqueTime ComplexityApplication
Bounded search treeO(f(k)n)O(f(k) \cdot n)Vertex cover, SAT
KernelizationReduce to O(f(k))O(f(k)) sizeVC kernel: O(k2)O(k^2)
Color codingColor vertices randomlyk-Path detection
Iterative compressionAdd vertices one by oneFVS, odd cycle transversal
TreewidthParameterize by treewidthMany problems on bounded treewidth

7. 📝 Practice Questions

Q1: Run vertex cover search tree on a triangle graph with k=2.
Answer: Pick edge (a,b):
  • Branch 1: Include a, recurse on {b,c} with k=1. Pick edge (b,c). Include b (k=0, no edges = valid). Cover: {a,b}.
  • Branch 2: Include b, recurse on {a,c} with k=1. Pick edge (a,c). Include a (k=0). Cover: {b,a} = same. Q2: Explain the Buss kernel for vertex cover.
Answer: (1) Remove isolated vertices (degree 0 — never needed). (2) If any vertex has degree > k, it MUST be in any k-cover (if not, its k+1 neighbors need k+1 vertices to cover). Add it to cover, reduce k by 1. (3) After removing high-degree vertices, remaining max degree ≤ k, so max edges = n*k/2. But we can bound n ≤ k²+k (since otherwise > k² edges). Kernel size: O(k²) vertices and edges. Q3: Why is Clique not believed to be FPT?
Answer: Clique is W[1]-complete. If Clique ∈ FPT, then W[1] = FPT, which would mean all W[1]-hard problems (Independent Set, Partial Vertex Cover) are FPT — widely considered unlikely. The hardness comes from the parameter k being in the exponent of n in the naive O(nk)O(n^k) brute force, and no f(k)nO(1)f(k)n^{O(1)} algorithm is known. Q4: What is the bounded search tree technique?
Answer: At each step, identify a structure (edge, cycle, formula clause) that requires branching into 2+ cases. Each branch reduces the parameter k. The tree depth is at most k, branching factor b, so total nodes ≤ b^k. If each node processes in polynomial time, total = O(b^k × n^{O(1)}).

8. 🔗 Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.