Now that we have one NP-complete problem, we can use that to find lots more. The basic idea is to transform SAT [or, in due course, any other NP-complete problem] to a new problem; because the transformation is transitive, this will show that any problem in NP can be transformed to our new problem, and so that the new problem is also NP-complete.
We start with a trivial but useful new problem:
We choose to transform from 3SAT.
Given an arbitrary instance of 3SAT, we construct some roads and
villages to correspond.
For each variable, such as A, in the formula, we make two villages,
which we can think of as A and not A, with a road between them.
In order to cover this road, either A or not A will have to
have a fort;
I'm not going to give you enough forts for both villages, so you will have
to choose whether A is true or false.
Now how about the clauses in the formula?
For each of these, we make three villages in a triangle with the roads
between them.
You will need two forts to cover these three roads;
I'm not going to give you a third fort, so each triangle will have to have
one village unguarded.
Now we join up each village in the triangle to the appropriate `variable';
see the diagram for an example.
Two of these new roads will be guarded by the two forts in the triangle,
but the third can't be, so must be guarded by a `variable' fort.
In other words, the formula is satisfiable if and only if there is an assignment of forts to the variables such that every triangle has one of its vertices connected to them. So, this instance of 3SAT corresponds precisely to VC for this network and for a number of forts equal to twice the number of triangles plus the number of variables. We can now complete our proof:
Again, there is a component for each variable.
This is very simple [see right];
in order to get between the two villages, you must choose either the
`high' road or the `low' road, so we can label one as A and the
other as not A.
For the clauses in the formula, we again use triangles.
The `roads' in these are joined to the `variable' roads by the
construction shown to the left;
in order to tour round all these villages, you must either come in along
the top road, go down, up, down and up, and out along the top road again,
or else similarly from the bottom road.
So, if we make the top edge of this construction be either the high road
or the low road, as appropriate, of a suitable variable, and the bottom
edge be one side of a triangle, we can enforce that a Hamiltonian tour
includes either a suitable variable or the edge of a triangle.
For any clause that cannot be satisfied, all the corresponding
villages must be toured from the triangle, not from the variables,
and this will, so to speak, `disconnect' the triangle from
the rest of the tour.
Everything else is detail;
see Papadimitriou pp. 194-197 if you get stuck.
You might wonder how on earth anyone thinks of these proofs.
Basically, you need ingenuity, experience and luck.
But the main ideas are straightforward enough.
You start with a `sympathetic' known NP-complete problem, if possible
one whose structure seems to be cognate to the problem you are investigating.
Then you need to construct a suitable instance of your problem from an
arbitrary instance of the known problem.
This could be some sort of special case, or a simple identity;
in the more difficult cases, you will have to use what Garey and Johnson
call `component design' -- that is, each feature of the known problem
will map to a construction in the new problem.
In transformations from 3SAT, the components are the variables,
which must be true or false, and the clauses,
which must connect with three variables;
so the design must provide ways of enforcing choices and of connecting
clauses to variables.