BITS Pilani
BITS Logo
CS G526: Advanced Algorithms and Complexity

Complexity: NP-Hardness Reductions I — Graph Problems

Lecture 26 |2026-10-19
Tulasimohan Molli
BITS Pilani, Hyderabad Campus

Agenda

  1. The Architecture of a Reduction — Forward, backward, and polynomial sanity checks.
  2. From Logic to Graphs: 3-SAT to CLIQUE — Consistency gadgets and clause clusters.
  3. The Graph Trinity — Clique, Independent Set, and Vertex Cover.
  4. Graph Complementation — Why \text{CLIQUE} \le_p \text{INDEPENDENT SET} is an involution.
  5. Set Partition Complementarity — Why \text{INDEPENDENT SET} \le_p \text{VERTEX COVER}.
  6. Direct Duality: CLIQUE to VERTEX COVER — Complementation shortcut.
  7. Summary of the Reduction Gallery — The foundational tree of NP-completeness.

Anatomy of a Valid Reduction

To prove language B is NP-complete given known NP-complete language A:

The 3 Mandatory Verification Steps

  1. Polynomial Construction Time: f(x) must be computed in O(|x|^c) deterministic time.
  2. Completeness (Forward Direction): x \in A \implies f(x) \in B
  3. Soundness (Backward Direction / Contrapositive): f(x) \in B \implies x \in A \quad (\text{or } x \notin A \implies f(x) \notin B)

The Target: CLIQUE

Definition: CLIQUE Problem

Given an undirected graph G = (V, E) and integer k:
Does G contain a subset S \subseteq V of size |S| = k such that every pair of vertices in S has an edge?

Status in NP

  • Clearly \text{CLIQUE} \in \mathbf{NP}:
    • Certificate: A vertex list S \subseteq V.
    • Polynomial Verifier: Check |S| = k and verify all \binom{k}{2} pairwise edges exist in E.

Hardness Goal

Prove \text{CLIQUE} is \mathbf{NP}-hard by reducing: \text{3-SAT} \le_p \text{CLIQUE} Once proved, \text{CLIQUE} is established as NP-complete.

3-SAT to CLIQUE: The Gadget

Let formula \phi have m clauses: \phi = C_1 \land C_2 \land \dots \land C_m, where C_r = (l_{r, 1} \lor l_{r, 2} \lor l_{r, 3}).

Clause Clusters

  • Create one cluster of 3 vertices for each clause C_r, representing its 3 literals: V = \{v_{r, 1}, v_{r, 2}, v_{r, 3} \mid r \in \{1, \dots, m\}\}
  • Total vertices: |V| = 3m.
  • Crucial Rule: NO edges within the same clause cluster!

Cross-Cluster Edge Rule

Connect literal u \in C_r to literal v \in C_s iff: 1. They come from different clauses (r \ne s), AND 2. They are consistent (not contradictory: u \ne \overline{v}).

. . .

Target Parameter

Set target clique size k = m (the number of clauses).

Anatomy of the Clause & Consistency Gadgets

3-SAT to CLIQUE: Visualized Example

\phi = (x_1 \lor x_2 \lor x_3) \land (\bar{x}_1 \lor \bar{x}_2 \lor x_3) \land (x_1 \lor \bar{x}_2 \lor \bar{x}_3)

Clause Breakdown

Clause 1 Clause 2 Clause 3
x_1 \bar{x}_1 x_1
x_2 \bar{x}_2 \bar{x}_2
x_3 x_3 \bar{x}_3
  • Red dashed lines with \times: Contradictory literal pairs (no edge permitted).
  • Bold blue edges: The selected 3-clique \{x_1 \in C_1, \bar{x}_2 \in C_2, x_1 \in C_3\} satisfying \phi!

Proof: Completeness (\phi \in \text{3-SAT} \implies G \text{ has } m\text{-clique})

  • Suppose \phi is satisfiable under assignment \tau \in \{0, 1\}^n.
  • In every clause C_r, at least one literal l_r^* evaluates to TRUE under \tau.
  • Select one such true literal from each clause cluster: S = \{l_1^*, l_2^*, \dots, l_m^*\} \quad (|S| = m)

Why is S Guaranteed to Form a Clique?

  1. Distinct Clusters: Exactly one literal chosen from each of the m clause clusters.
  2. Mutual Consistency: All literals in S are TRUE under the same truth assignment \tau.
    • A variable and its negation cannot both be true simultaneously (\tau(x) \ne \tau(\bar{x})).
    • Hence, no pair of literals in S is contradictory (l_i^* \ne \overline{l_j^*}).
  3. Edges Exist: By our construction rule, an edge connects every non-contradictory cross-cluster pair.
  4. Therefore, every pair in S has an edge: S is an m-clique! \checkmark

Proof: Soundness (G \text{ has } m\text{-clique} \implies \phi \in \text{3-SAT})

  • Suppose graph G contains a clique S of size |S| = m.

Clause Partition Property

  • No edges exist between vertices within the same clause cluster.
  • Therefore, a clique can contain at most one vertex from any single clause cluster.
  • Since |S| = m and there are exactly m clusters, S must contain exactly one vertex from each clause cluster!

. . .

Extracting the Satisfying Assignment

  • All vertices in S have pairwise edges, so no two literals in S are contradictory.
  • Construct assignment \tau: \tau(x_i) = \begin{cases} 1 & \text{if literal } x_i \in S \\ 0 & \text{if literal } \bar{x}_i \in S \\ \text{arbitrary} & \text{if neither occurs in } S \end{cases}
  • Since each clause has at least one representative literal in S set to TRUE, every clause is satisfied.
  • Thus, \phi is satisfiable! \checkmark

The Graph Trinity

Three foundational graph problems linked by geometric and set dualities:

Complementation: CLIQUE to INDEPENDENT SET

Definition: INDEPENDENT SET Problem

Given an undirected graph G = (V, E) and integer k:
Does G contain a subset S \subseteq V of size |S| = k such that no two vertices in S share an edge?

The Graph Complement \overline{G}

  • Same vertex set: V(\overline{G}) = V(G).
  • Complement edges: (u, v) \in E(\overline{G}) \iff (u, v) \notin E(G).
  • Complementation is an involution: \overline{\overline{G}} = G.

Duality Lemma

S \text{ is a Clique in } G \iff S \text{ is an Independent Set in } \overline{G}

The Reduction

f(\langle G, k \rangle) = \langle \overline{G}, k \rangle Computing \overline{G} takes O(|V|^2) time. Immediate NP-completeness of INDEPENDENT SET!

Visualizing Graph Complementation Duality

INDEPENDENT SET to VERTEX COVER

Definition: VERTEX COVER Problem

Given G = (V, E) and integer k':
Find subset C \subseteq V of size |C| \le k' such that every edge e \in E has at least one endpoint in C.

The Partition Theorem

For any graph G = (V, E) and any subset S \subseteq V: S \text{ is an Independent Set} \iff V \setminus S \text{ is a Vertex Cover}

Proof: The Partition Duality

\text{Let } C = V \setminus S.

(\implies) S is Independent \implies C is a Cover

  • Consider an arbitrary edge (u, v) \in E.
  • Since S is an independent set, u and v cannot both belong to S (zero internal edges).
  • Therefore, at least one of \{u, v\} must lie outside S, i.e., in V \setminus S = C.
  • Hence, C touches edge (u, v)!
  • Since (u, v) was arbitrary, C is a vertex cover.

(\impliedby) C is a Cover \implies S is Independent

  • Suppose for contradiction that S is not an independent set.
  • Then there exists some edge (u, v) \in E with both endpoints u, v \in S.
  • But then neither u nor v belongs to C = V \setminus S.
  • Thus edge (u, v) has neither endpoint in C, contradicting that C is a vertex cover!
  • Hence S must be independent.

\text{Reduction: } \quad f(\langle G, k \rangle) = \langle G, \ |V| - k \rangle Parameter conversion takes O(1) time! VERTEX COVER is NP-complete. \checkmark

Direct Duality: CLIQUE to VERTEX COVER

By combining graph complementation and set partitioning, we obtain a direct reduction:

Theorem (Clique-Cover Duality)

S \subseteq V \text{ is a } k\text{-clique in } G \iff V \setminus S \text{ is a } (|V|-k)\text{-vertex cover in } \overline{G}

The Direct Recipe

  1. Compute the graph complement \overline{G} = (V, \overline{E}).
  2. Set target cover size k' = |V| - k.
  3. Output instance \langle \overline{G}, k' \rangle.

Coming Up Next

Today’s Milestones

  1. Established the 3 verification pillars: Time, Completeness, Soundness.
  2. Encoded Boolean satisfiability into edge connectivity via clause clusters.
  3. Mastered the Graph Trinity: \text{CLIQUE} \leftrightarrow \text{IS} \leftrightarrow \text{VC}.

Lecture 27 (Reductions II: Paths & Numbers)

  • Moving beyond node selection to ordered structures and numerical constraints:
    • Hamiltonian Path & Cycle: Directed/undirected cycle gadgets.
    • Subset Sum & Knapsack: Translating Boolean decisions into decimal digits and base-B arithmetic!