Algorithm Search⌘K

Proofs: Carraghan-Pardalos algorithm

These are the human proofs of Carraghan-Pardalos algorithm, at full length.

The Carraghan-Pardalos algorithm returns a maximum clique full

This proof shows: correctness, termination.

Let G=(V,E)G = (V, E) be a finite simple undirected graph and N(v)N(v) the set of neighbors of vv. The variable best holds a vertex list; we write ∣best∣|{\rm best}| for its length and treat it as a set. For a call EXPAND(C,P)(C, P), where PP is a list of distinct vertices, let

μ(C,P)=max⁡{∣K∣:K is a clique of G, C⊆K⊆C∪P}.\mu(C, P) = \max \{ |K| : K \text{ is a clique of } G,\ C \subseteq K \subseteq C \cup P \}.

Precondition (Q). CC is a clique, P∩C=∅P \cap C = \emptyset, and every vertex of PP is adjacent to every vertex of CC.

Invariant (B). best is a clique of GG. It holds at line L2, since ∅\emptyset is a clique. Line L9 is the only place that changes best, and it sets best to C∪{v}C \cup \{v\} with vv taken from PP under (Q), which is a clique. The value ∣best∣|{\rm best}| never decreases, since line L9 changes best only to a longer list.

Claim. Assume (Q), and that P≠∅P \ne \emptyset or C=∅C = \emptyset. Then EXPAND(C,P)(C, P) terminates, all its recursive calls satisfy (Q), and when it returns, ∣best∣≥μ(C,P)|{\rm best}| \ge \mu(C, P).

Proof. Induction on ∣P∣|P|.

If PP is empty, then C=∅C = \emptyset and μ=0≤∣best∣\mu = 0 \le |{\rm best}|. The loop does not run.

Let P=(p1,…,ps)P = (p_1, \ldots, p_s) with s≥1s \ge 1. The loop of line L5 removes the first element of the list at each pass of line L7, so it makes at most ss passes. Before pass jj the list is Pj=(pj,…,ps)P_j = (p_j, \ldots, p_s). Split the cliques KK with C⊆K⊆C∪PC \subseteq K \subseteq C \cup P into K=CK = C and, for each jj, the cliques whose element of K∖CK \setminus C with the smallest position in PP is pjp_j. Call the second group Kj\mathcal{K}_j. A clique in Kj\mathcal{K}_j lies in C∪PjC \cup P_j.

We show: when pass jj ends without a return, ∣best∣≥∣K∣|{\rm best}| \ge |K| for every K∈KjK \in \mathcal{K}_j; and when the call returns at line L6 before pass jj starts, ∣best∣≥∣K∣|{\rm best}| \ge |K| for every K∈KiK \in \mathcal{K}_i with i≥ji \ge j.

  • Pass jj ends. Line L7 takes v=pjv = p_j, and line L8 forms Q=(pj+1,…,ps)∩N(v)Q = (p_{j+1}, \ldots, p_s) \cap N(v) in list order. Each K∈KjK \in \mathcal{K}_j satisfies K⊆C∪{v}∪QK \subseteq C \cup \{v\} \cup Q, since its other vertices outside CC come after pjp_j and are adjacent to vv. If QQ is empty, K=C∪{v}K = C \cup \{v\}, and line L9 ensures ∣best∣≥∣C∣+1=∣K∣|{\rm best}| \ge |C| + 1 = |K|. If QQ is not empty, line L10 calls EXPAND(C∪{v},Q)(C \cup \{v\}, Q). This call satisfies (Q): C∪{v}C \cup \{v\} is a clique because vv is adjacent to all of CC, and every vertex of QQ is in PP, so adjacent to all of CC, and is in N(v)N(v). Also ∣Q∣≤s−1<∣P∣|Q| \le s - 1 < |P|. By induction, after it returns, ∣best∣≥μ(C∪{v},Q)≥∣K∣|{\rm best}| \ge \mu(C \cup \{v\}, Q) \ge |K|.
  • Return at line L6 before pass jj. Then ∣C∣+∣Pj∣≤∣best∣|C| + |P_j| \le |{\rm best}|. Every K∈KiK \in \mathcal{K}_i with i≥ji \ge j lies in C∪PjC \cup P_j, so ∣K∣≤∣C∣+∣Pj∣≤∣best∣|K| \le |C| + |P_j| \le |{\rm best}|.

Since ∣best∣|{\rm best}| never decreases, at the return of the call every KK in some Kj\mathcal{K}_j has ∣K∣≤∣best∣|K| \le |{\rm best}|: either pass jj ended, or the call returned at line L6 at or before pass jj.

It remains to treat K=CK = C. If the first pass returns at line L6, then ∣C∣≤∣C∣+∣P∣≤∣best∣|C| \le |C| + |P| \le |{\rm best}|. Otherwise the first pass ends, and it leaves ∣best∣≥∣C∣+1|{\rm best}| \ge |C| + 1: either line L9 ran with ∣C∣+1|C| + 1, or the recursive call EXPAND(C∪{p1},Q)(C \cup \{p_1\}, Q) returned with ∣best∣≥μ(C∪{p1},Q)≥∣C∣+1|{\rm best}| \ge \mu(C \cup \{p_1\}, Q) \ge |C| + 1, since C∪{p1}C \cup \{p_1\} is itself a clique counted by μ\mu.

So ∣best∣≥μ(C,P)|{\rm best}| \ge \mu(C, P) when the call returns. The call terminates, because the loop has at most ss passes and each recursive call terminates by induction. □\square

Theorem. CARRAGHAN-PARDALOS(G)(G) terminates and returns a maximum clique of GG.

Proof. Line L3 calls EXPAND(∅,(v1,…,vn))(\emptyset, (v_1, \ldots, v_n)) with the list of line L1. The precondition (Q) holds trivially, and C=∅C = \emptyset. By the claim, the call terminates with ∣best∣≥μ(∅,V)=ω(G)|{\rm best}| \ge \mu(\emptyset, V) = \omega(G). By (B), best is a clique, so ∣best∣≤ω(G)|{\rm best}| \le \omega(G). So best is a clique of size ω(G)\omega(G), and line L4 returns it, sorted. The order of line L1 is not used in the proof, so the result is correct for every order. ■\blacksquare

Back to Carraghan-Pardalos algorithm