Polynomial time algorithm for k-clique problem (small question/request)

1.1k Views Asked by At

I actually do not know whether I should ask this here or in CS, but I definitely prefer a mathematical algorithm since it usually can be implemented easily.

I would like to find some basic/early algorithms for finding a clique of certain size in a graph, in particular regular graph but general graph is also fine. It is known that there is a polynomial time algorithm for this. I am new to this clique finding topic, but by "basic", I mean a not-so-hard algorithm.

I have searched online and seem to find algorithms claimed to be in polynomial time, but somewhat in an improved form or new (like based on new concepts or heavily modified). Maybe I am not searching hard enough. I would prefer an old one or a brute force one or one based on less concepts. Any suggestion is highly appreciated. Thank you very much.

EDIT: By certain size, I mean the value $k$ is given (fixed value). The wikipedia article says "Thus, the problem may be solved in polynomial time whenever $k$ is a fixed constant. However, when $k$ does not have a fixed value, but instead may vary as part of the input to the problem, the time is exponential." My main concern is when $k$ is fixed.

EDIT: I add info that my graph is regular.

1

There are 1 best solutions below

1
On

The decision problem of, "given a graph $G$ and a number $k$, does there exist a clique of size at least $k$?" is well-known to be $\mathsf{NP}$-complete, so there in no known polynomial-time algorithm for it.

That said, if $k$ is a fixed constant, the brute force algorithm of simply trying all ${n \choose k}$ subsets of $k$ nodes and checking if all roughly $k^2$ edges are there gives a $O(n^kk^2)=n^{O(1)}$ algorithm. But again, this is only if $k$ is a fixed constant, not a parameter of the input. There's probably mild speedups to this simple approach, but likely aren't significantly better than this approach in the worst case.