9.23
Idea
A clique is a set of vertices that are all pair-wise adjacent. A maximum clique is the largest such set.
The fastest exact technique in practice is a depth-first branch-and-bound based on the Bron–Kerbosch enumeration with pivoting, augmented with pruning by coloring (Tomita et al.).
At every node we maintain:
1. R
– vertices already chosen for the current clique,
2. P
– candidates that can still be added (all adjacent to every v in R
),
3. X
– vertices already explored and therefore forbidden,
and bound the search by an upper estimate of the best clique still reachable from P
.
The estimate is produced by greedy graph coloring: if the current best clique has size best
and |R| + color(P) ≤ best
, we stop exploring this branch.
Pseudocode
Worst-case time is O(3n/3), but branch-and-bound with coloring is dramatically faster on real graphs. Space is O(n2) for the adjacency matrix plus recursion stack O(n).
How to use
Feed
graph
as a Boolean adjacency matrix; the function returns a list of vertex indices forming a maximum clique. Because it is exact, the first clique returned is guaranteed to be optimal.
Back to
Chapter 9