Why can you find a $k$-clique in polynomial time, but determining if there is a $k$-clique is NP-complete?

1.7k Views Asked by At

You can find a $k$-clique in $n^k$ time by examining all possible sets of vertices of size $k$. So why is it NP-complete to determine if there is a clique of size greater than $k$? It looks like you can solve it in polynomial time if $k$ is a constant.

1

There are 1 best solutions below

1
On BEST ANSWER

Indeed we could resolve the $k$-clique problem for fixed $k$ by inspecting $\binom{n}{k}$ subgraphs. However, the number $k$ is considered an input to the problem too.

In the $k$-clique problem, the input is an undirected graph and a number $k$, and the output is a clique of size $k$ if one exists (or, sometimes, all cliques of size $k$). -- Wikipedia

If e.g. $k=\lfloor n/2 \rfloor$, then $\binom{n}{k}$ increases exponentially (not polynomially) with the input size.