graph complement

IS ≤p CLIQUE

IS≤pCLIQUE\mathrm{IS}\le_p\mathrm{CLIQUE}: a polynomial algorithm for CLIQUE\mathrm{CLIQUE} would also solve IS\mathrm{IS}.

The construction

On input ⟨G,K⟩\langle G,K\rangle with G=(V,E)G=(V,E) and K∈NK\in\mathbb{N}:

  1. Build the complement graph Gˉ=(V,Eˉ)\bar G=(V,\bar E), where Eˉ={xy ∣ x,y∈V, x≠y}∖E=(V2)∖E.\bar E=\Big\{xy\ \Big|\ x,y\in V,\ x\ne y\Big\}\setminus E=\binom{V}{2}\setminus E .
  2. Return ⟨Gˉ,K⟩\langle\bar G,K\rangle.

The number KK is untouched; only the graph flips.

Visualization

Guided construction

Independent Set → Clique

Step 1 of 6
Independent Set to Clique via graph complementA path on four vertices is complemented; an independent pair becomes a clique while the threshold stays k.Source G1234Complement Ḡ1234
Original edge (removed)Complement edge (added)

Correctness — both directions

IS ∈ ⟹ CLIQUE ∈

Suppose ⟨G,K⟩∈IS\langle G,K\rangle\in\mathrm{IS}. Then some U⊆VU\subseteq V with ∣U∣=K|U|=K is independent in GG.

Consider the same UU inside Gˉ\bar G — legitimate, since both graphs share the vertex set VV. Then U⊆VU\subseteq V and ∣U∣=K|U|=K. It remains to show UU is a clique in Gˉ\bar G: let x,y∈Ux,y\in U be distinct. Since UU is independent in GG we have xy∉Exy\notin E, and by definition of the complement every non-edge of EE on distinct vertices is an edge of Eˉ\bar E; so xy∈Eˉxy\in\bar E. Hence UU is a clique in Gˉ\bar G, i.e. ⟨Gˉ,K⟩∈CLIQUE\langle\bar G,K\rangle\in\mathrm{CLIQUE}.

CLIQUE ∈ ⟹ IS ∈

Suppose ⟨Gˉ,K⟩∈CLIQUE\langle\bar G,K\rangle\in\mathrm{CLIQUE}. Then some U⊆VU\subseteq V with ∣U∣=K|U|=K is a clique in Gˉ\bar G (naming the graph is mandatory — there are two of them here).

Consider the same UU inside GG. Then U⊆VU\subseteq V and ∣U∣=K|U|=K. Let x,y∈Ux,y\in U be distinct. Since UU is a clique in Gˉ\bar G, xy∈Eˉxy\in\bar E, and by definition of the complement xy∉Exy\notin E. Hence UU is independent in GG, i.e. ⟨G,K⟩∈IS\langle G,K\rangle\in\mathrm{IS}.

Cost of the reduction

TimeO(|V|²) with an adjacency matrix
SpaceO(|V|²)
Output sizeO(|V|²)

With an adjacency matrix, testing "is xy∈Exy\in E" costs O(1)O(1), so scanning all (∣V∣2)\binom{|V|}{2} pairs costs O(∣V∣2)O(|V|^2). With an edge list, rescanning per pair gives O(∣V∣2⋅∣E∣)O(|V|^2\cdot|E|). Both are polynomial, so for the claim there is no difference — which is exactly why implementation detail may be treated loosely here.

What it buys

IS\mathrm{IS} is no harder than CLIQUE\mathrm{CLIQUE}. With the converse reduction the two problems are equivalent under ≤p\le_p: one is in P\mathrm P iff the other is, and one is NP-complete iff the other is.

Pitfalls

  • "Delete the clique's edges" — rejected at once: the reduction cannot find a clique, and the whole point is that we cannot solve the problem. The same trap appears in computability: a reduction from HALT\mathrm{HALT} cannot test whether its input is in the language.

  • "Delete every edge" — the output is then never in CLIQUE\mathrm{CLIQUE} (for K≥2K\ge2), whatever the input; that kills the "if" direction. "Add every edge" — the output is then always in CLIQUE\mathrm{CLIQUE}; that kills the other. Any operation producing a predetermined output breaks one direction, so the operation must swap, not flatten.

The chain

Used later by

Where this was read from

  • Lesson 7משפט 3: IS≤pCLIQUE\mathrm{IS} \le_p \mathrm{CLIQUE}
  • Guided exerciseindependent-set-to-clique