简体   繁体   中英

NP-Complete reduction

The problem states that we want to show that Independent Set poly-time reduces to Relative Prime Sets, more formally Independent Set <p Relative Prime Sets .

I need to provide a reduction f from ind.set to rel. prime sets, where

- input of f must be a Graph G and an integer k, where k denotes the size of an independent set.

- output of f must be a set S of integers and an integer t, where t denotes the number of pairwise relative prime numbers in the set S.

Definition of relative prime sets (decision version):

it takes a set P of n-integers and an integer t from 1 to n.

returns yes if there's a subset A of P, with t-many pairwise relative primes. That is, for all a, b in A, it must be true that gcd(a, b) = 1.

returns no otherwise

So far I have come-up with what I believe is a reduction, but I am not sure if it is valid and I want to double check it with someone who knows how to do this.

Reduction:

Let G be a graph.Let k indicate the size of an independent set. Then we want to find-out if there exists an independent set of size k in G. Since this problem is NP-Complete, if we can solve another NP-Complete problem in poly-time, we know that we can also solve Independent Set in poly-time. So we chose to reduce independent set to Relative Prime Sets.

We take the graph G and label its vertices from 1 to n as pr the definition of the input for relative prime sets. Then we find the gcd of each node to every other node in G. We draw an edge between the nodes that have gcd(a, b) = 1. When the graph is complete, we look at the nodes and determine which nodes are not connected to each other via an edge. We create sets for those nodes. We return the set containing the most nodes along with an integer t denoting the number of integers in the set. This is the set of the most relative prime numbers in the graph G and also the greatest independent set of G.

Suppose two graphs, each of four nodes. On graph one, the nodes are connected in a line so that the max-independent set is 2. Graph two is a complete graph each node is connected to each other node, so the max-independent set is 1.

It sounds like your reduction would result in the same set for each graph, leading to an incorrect result for independent set.

方程式,S = k * lnW离散的logaritm不能被破坏,因为它与信息熵相关联

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM