Showing a problem on a specific graph is NP-hard

Maybe there is a trivial answer to my question or maybe there is not any. But I ask it here and appreciate if anyone can give me a clear answer.

We know that a set of problems like minimum clique cover problem, coloring problem, vertex cover, ... are NP-hard for general graphs, but maybe polynomial-time solvable for specific graphs.

My question is that, if we are given a graph $G=(V,E)$ (I am asking this generally but you can specifically assume the graph described here), and want to find for example minimum clique cover for this graph, how can we show that it is NP-hard (if it is)? Is there any method for that?

• Interesting question. The obvious way is to check in which special class of graphs the problem can be polynomial solvable (if it can be). I.e In perfect graphs and triangle-free graphs the minimum clique cover can be found in polynomial time. I don't know if there is a generic method for that. Jan 21 '17 at 22:38
• Α small clarification. The problem is proven to be NP-Hard / NP-Complete no matter what (computational complexity theory). You don't prove that the problem is NP-hard on your graph but you prove that the particular instance (or a class of instances) can be or not solvable in polynomial time. Jan 21 '17 at 22:44
• @Laxmana Yes, checking whether the graph of my problem belongs to the special class was the first thing that I checked. But, if not, what is the next step? Jan 22 '17 at 0:13
• @Laxmana Regarding your second comment, you are somehow right, but assume that you have a practical problem that you have modeled it as a graph problem and the solution to the practical problem is the same as finding minimum clique cover for this graph. Then, it is a quite reasonable question to ask whether the practical problem is NP-hard/NP-complete. In that case, the fact that the minimum clique cover is generally NP-hard is not useful for you, because your are dealing with a particular graph. Jan 22 '17 at 0:17
• Are you asking about a decision problem on a restricted, but infinitely large, class of graphs or on a finite class of graphs? In the latter case the problem is solvable in constant time. Jan 22 '17 at 9:02

There's no such thing as a hard instance. You can always figure out the answer to that one instance and then hard-code that into an algorithm. For example, you can always have an algorithm for SAT that says

if input="(XvY)^(!Xv!YvZ)"
return SATISFIABLE
else
[loop through all possible variable assignments]

Incidentally, this is why nobody looks at "best-case complexity", since any algorithm can be adapted to run in best-case constant time in this way. (Constant because you only have to read a fixed amount of the input to see if it's one of the ones that you have a hard-coded answer for.)

There's a category error in asking if an instance can be NP-complete. Recall the definition of what NP-completeness is:

A language $L$ is NP-complete if is in NP and every other language in NP is polynomial-time many–one reducible to $L$.

First, that statement doesn't "type-check" if you try to make $L$ be a string rather than a language. Second, the definition of many–one reductions requires that you have at least one "yes" instance and at least one "no" instance to use as targets for the reduction. One instance isn't enough to make these definitions work.

• The maximum length of your hardcoded instances is some constant, so you only need to check a constant length prefix of the input. Finite languages can therefore be decided in constant time, no? Jan 22 '17 at 13:12
• You are right. But I didn't describe my question correctly. I updated my question. I am not asking about a specific graph. My bad. Jan 22 '17 at 19:02
• @m0_as Could you please ask that as a new question? Questions shouldn't be edited in a way that invalidates existing answers, so I'm reverting the edit. Jan 22 '17 at 19:13
• that's right. sorry. Jan 22 '17 at 19:14
• @DavidRicherby :) I don't know whether there is any answer to the new question. Jan 22 '17 at 21:46

A problem cannot be NP-hard for a particular graph (unless P=NP). This is because for every particular instance, there is a zero-time algorithm that solves the problem on that instance perfectly. The concept of NP-hardness only makes sense for an infinite family of instances.

In fact, much more is true. Even an uncomputable problem is computable on any given instance. Both computability and complexity are notions that only make sense in the number of instances is infinite.

We can say even more. Suppose that some problem is, indeed, NP-hard. For every particular instance we can find a constant time algorithm that solves the problem on that instance in constant time. This is because we can hardwire the solution for that particular instance.

• What is a zero-time algorithm ? Jan 22 '17 at 11:27
• @Laxmana For example, a Turing machine in which the initial state is also a final state. Jan 22 '17 at 11:57
• @YuvalFilmus So in that part of your answer you're imagining a model where the TM gives the right answer for this particular instance, but is allowed to give wrong answers for other instances? Jan 22 '17 at 13:29
• @DavidRicherby Right. It's a promise problem, and the promise is that the input is that particular instance. Jan 22 '17 at 15:38
• @m0_as Not exactly. You can solve the problem on any specific single graph by hardcoding the answer. This only works for finitely many graphs. Jan 22 '17 at 22:02