-2

Goal: Find a simple path in G, that visits the maximum number of vertices in Z and prove it is NP-complete.

G = (V , E)

Z is a subset of V

How would I go about doing this?

  • Your question seems misstated. I think you mean to show that a certain problem is NP-complete, namely, the problem of finding such a path. "Problem" in complexity theory is a technical term. – Caleb Stanford Dec 07 '17 at 03:30
  • 1
    What did you try? Where did you get stuck? What's preventing you from solving it yourself? Presumably you'll need to construct a reduction. What problems have you tried reducing from? What difficulties did you run into? We're happy to help you understand the concepts but just solving exercises for you is unlikely to achieve that. You might find this page helpful in improving your question. – D.W. Dec 07 '17 at 06:10
  • https://cs.stackexchange.com/q/1240/755, https://cs.stackexchange.com/q/11209/755 – D.W. Dec 07 '17 at 06:11
  • @6005 I agree, though "prove it" is probably intended to mean "prove that the problem of finding the path" rather than "prove that the path". – David Richerby Dec 07 '17 at 10:58

2 Answers2

1

By thinking about what NP-complete problems you already know about that involve finding very long paths in graphs.

David Richerby
  • 81,689
  • 26
  • 141
  • 235
1

First, a nitpick about your question: "and prove it is NP-complete" sounds like the problem asks to prove that the simple path is NP-complete, which is of course nonsense. Instead, your problem should probably state simply to find the path. So, while this may sound like a nitpick, so that we are sure we are on the same page, I will restate the problem:

Input: A graph $G = (V, E)$ and a set $Z\subseteq V$.
Output: A simple path in $G$ that maximizes the number of visited vertices in $Z$.

The question is then to show that the above problem is NP-complete. It may or may not be useful to consider a decision version of this problem: $L = \{ \langle G, Z, k\rangle\mid G=(V,E)\text{ and }G\text{ contains a simple path visiting }k\text{ vertices of }Z\}$

Nitpicking aside, let's examine the problem. To avoid simply handing out a solution without you having shown an effort to solve it yourself, I will be somewhat vague.

Remember that to show a problem is NP-complete, we must show a reduction from a known NP-Hard problem to the given problem. Try to think about what NP-Hard problems are similar to this problem. Can you think of any other problems on graphs that ask for a simple path that visits a large number of vertices?

If you're still having trouble, consider an instance of the stated problem where $Z=V(G)$ (and, for the decision version, $k=|V|$). Does this seem similar to an NP-complete problem you have heard of?

ngrammel
  • 99
  • 5
  • There are a couple of problems with this answer. Most significantly, reducing an NP-hard problem to $X$ is not enough to show that $X$ is NP-complete. Second, the problem you state can't be NP-complete, because NP is a class of decision problems. Posting a nitpick is fine but the nitpick needs to be correct. – David Richerby Dec 07 '17 at 10:56