The Theory of Computation
Bernard M.E. Moret
Addison-Wesley-Longman, 1998
Detailed Solutions
Chapter 7, Problem 7.27, Part 3
Prove that Maximum-Leaves Spanning Tree is NP-complete.
Instance: a graph, , and a bound on the number of leaves
of the spanning tree, .
Question: does have a spanning tree with at least
leaves?
Input Encoding and Size:
An instance of this problem can be described by the two sets, and
, which costs ceiling for
(no need to name the elements here) and ceiling
for (naming each pair); or it can be described by adjacency lists,
one for each vertex, which will cost ceiling
(each list needs a terminator, hence the +1; the total number of list elements
is plus the terminators, of them).
In either case, the input size is .
This representation is best suited to sparse graphs; for dense graphs,
we might want an adjacency matrix representation, which would be more concise,
taking only space. Since the graph might as well
be assumed to be connected (otherwise it cannot have any spanning tree whatsoever),
the number of edges is bounded above and below by a polynomial function in
the number of vertices, . Thus the input
size is bounded above and below by a polynomial function of .
Certificate Description and Verification:
The problem is in NP: a certificate is just a list of edges that make up the
desired spanning tree. Given such a list, call it , we can verify that
the graph is a tree and has at least leaves
in time proportional to , which is safely polynomial in the
input size.
Mapping:
We prove the problem NP-complete by reducing the known NP-complete problem X3C to it. An instance of X3C has a set of
elements and a collection of subsets of ,
each of which has exactly 3 elements; it can be encoded as triples,
each requiring 3 ceiling bits, plus the size of ,
taking ceiling bits, for an input size of .
Given such an instance of X3C, we construct the graph
for our problem as follows. We let be the union of