Problem 1
We define our supermarket problem as an NP problem:
Problem
: SUPER
Input
: A list of customers, and the items they have purchased, and an integer
l.
Question
: Is there a subset
S
of customers of size
l
such that no two customers in
S
have bought the
same item?
First, we note that this problem is indeed in NP. If there is such a subset of customers, then the subset
itself is our certificate. We simply go through the items each customer has purchased, and if check that
there are no duplicates. This takes
O
(number of items).
We will show that SUPER is NPcomplete. First, we select a problem known to be NPcomplete, the
Independent Set problem:
Problem
: IND SET
Input
: A graph
G
= (
V
,
E
), integer
k
.
Question
: Is there a subset
S
of
k
vertices so that no two vertices in
S
share an edge?
To show SUPER is NPcomplete, we reduce any instance of IND SET to an instance of SUPER, in
polynomial time.
Reduction
:
Given a graph
G
and integer
k
as input to IND SET, we create an instance of SUPER as follows:
•
For each vertex in
G
, create a customer in SUPER.
•
For each edge in
G
create an item in SUPER.
•
A customer has bought an item if and only if its corresponding vertex is incident to the item's
corresponding edge.
•
Let
l
=
k
.
e.g.
Customers
Items bought
1
1,2,3
2
1
3
4
4
2
5
3,4,5
6
5
Clearly this can be done in polynomial time. We can do this by a Breadth First Search.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Winter '03
 Perkins
 Graph Theory, Vertex, Computational complexity theory, NPcomplete problems, independent set, IND SET

Click to edit the document details