Last week it was pointed out to me that my reduction for Balanced Complete Bipartite Subgraph was wrong, and in my searches to fix it, I found that the real reduction (by Johnson) used a variant of Clique that said (without proof)) that Clique is NP-Complete even if K was fixed to be |V|/2. I looked up the Clique problem in G&J, and they say in the comments that it is NP-Complete for K = any fixed ratio of V.
I thought this was a neat easy problem that fit in the 3-6 difficulty range I mentioned last week and decided it was worth a post. But thinking about this brings up some subtle issues relating to ratios and constants that are common sources of errors among students. I’ll talk about that at the end.
The problem: I don’t know if there is an official name, so I’m calling it “Ratio Clique”. It is mentioned in the comments to GT19 (Clique).
The description: For any fixed number r, 0< r < 1, does G have a clique of size r*|V| or more?
Example: Here’s a graph we’ve used for a previous problem:
If r = .5, then r*|V| = 3.5. So we’re asking if a clique of 3.5 or more vertices exists (which really means a clique of 4 or more vertices). It does not exist in this graph. If r ≤ , then we would be looking for a clique of size 3, which does exist in this graph (vertices b, c, and t)
The reduction: We will be reducing from the regular Clique problem. Since we want to show this “for any fixed value of r”, we can’t change r inside our reduction.
So we’re given a graph G=(V, E) and a K as our instance of Clique. We need to build a graph G’=(V’, E’) that has a fixed K’ = ⌈r*|V’|⌉.
G’ will start with G, and will add new vertices to the graph. The vertices we add depend on the ratio s of K to |V| (K = ⌈s*|V|⌉). K’ is initially K, but may change as vertices are added to the graph.
If r > s, then we need to add vertices to V’ that will connect to each other vertex in V’, and will increase K’ by 1. This increases the ratio of , and we keep adding vertices until that ratio is at least r.
If G has a clique of size K, then the extra vertices in K’ can be added to the clique to form a larger clique (since these new vertices connect to every other vertex)
If G’ has a clique of size K’, notice that it must contain at least K vertices that were initially in G. (We only added K’-K new vertices). These vertices that exist in G are all connected to each other and so will form a clique in G.
If r < s, then we will add vertices to V’ that are isolated (have no edges connecting to them). K’ will stay equal to K. Each vertex we add will reduce the ratio of , and we keep adding vertices until K=⌈r*|V’|⌉.
Since these new vertices can not be part of any clique in G’, any clique in G’ must consist only of vertices from G. Since K=K’, this gives us a clique of size K in both graphs.
It is probably also worth mentioning just how many vertices need to get added to the graph in each case, to make sure that we are adding a polynomial number. If r>s, we will be adding w vertices to satisfy the equation: ⌈s*|V|⌉ + w = ⌈r*(|V|+w)⌉
(These are both ways of expressing K’)
Dropping the ceiling function (since it only leads to a difference of at most one vertex) Solving for w gets us w = . Since r > s, both sides of that division are negative, so w ends up being positive, and polynomial in |V|.
If r < s, we will be adding w vertices to satisfy the equation:
⌈s*|V|⌉ = ⌈r(|V|+w)⌉
(These are both ways of expressing K)
This can similarly be solved to w = s|V|-r|V|. Since s > v, this is also a positive (and polynomial) number of new vertices.
A possible source of mistakes: I’m pretty sure this reduction works, but we need to be careful that there is a difference between “for any fixed ratio r of |V|” and “for any fixed K”. Because for a fixed K (say, K=7) solving the “Does this graph have a 7-Clique?” problem can be solved in polynomial (by enumerating all subgraphs of size 7, for example. There are subgraphs, which is O()). By choosing a ratio instead of a constant K, we gain the ability to scale the size of K’ along with the size of the graph and avoid this issue. But it is worth mentioning this to students as a possible pitfall. It’s very easy to do things in a way that effectively is treating r|V| as a constant K, which won’t work.
Difficulty: 3, but if you’re going to make students to the algebra to show the number of vertices that are added, bump it up to a 4.