2

I believe that the Hamiltonian cycle problem can be summed up as the following:

Given an undirected graph G = (V, E), a Hamiltonian circuit is a tour in G passing through every vertex of G once and only once.

Now, what I would like to do is reduce my problem to this. My problem is:

Given a weighted undirected graph G, integer k, and vertices u, v both in G, is there a simple path in G from u to v with total weight of AT LEAST k?

So knowing that the Hamiltonian cycle problem is NP-complete, by reducing this problem to the Hamiltonian, this problem is also proved NP-complete. My issue is the function reducing it to Hamiltonian.

  1. The big issue is that the Hamiltonian problem does not deal with edge weights, so I must convert my graph to one that doesn't have any weights.
  2. On top of that, this problem has a designated start and finish (u and v), whereas the Hamiltonian finds a cycle, so any start is the same as the finish.

For (1), I am thinking along the lines of passing a graph with all simple paths of total weight LESS THAN k taken out. For (2), I am thinking that this is not really an issue, because if there is a Hamiltonian cycle, then the simple path from u to v can be sliced out of it.

So, my real questions are:

  1. Is my solution going to give me the right answer?
  2. If yes, then how can I take out the edges that will produce simple paths of total weight less than k WITHOUT affecting the possibility that one of those edges may be required for the actual solution? Because if an edge e is taken out because it produces a simple path of weight < k for a subset of E, it can still be used in a simple path with a different combination of edges to produce a path of weight >= k.

Thanks!

Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
Garrett
  • 11,451
  • 19
  • 85
  • 126

3 Answers3

6

Your reduction is in the wrong direction. To show that your problem is NP-complete, you need to reduce Hamilton Circuit to it, and that is very easy. I.e. show that every Hamilton Circuit problem can be expressed in terms of your problem variant.

Antti Huima
  • 25,136
  • 3
  • 52
  • 71
4

More of a hint than an answer:

A unweighted graph can be interpreted as a weighted graph where each edge has weight 1. What would the cost of a Hamiltonian cycle be in a graph like that?

Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
  • Ok, so I can split every edge e into w(e) edges, but that would only work for weights >= 1, wouldn't it? Also, say I were to go along with that, then how do I know that the Hamiltonian cycle will give me the longest path (ie. what if the Hamiltonian cycle included a path of length k-1, when there was another path of length k)? – Garrett Dec 04 '11 at 02:01
  • 1
    Garrett: Please recognize you are doing the reduction in wrong way; for example you can reduce any polynomial time problem L in P to Hamiltonian path (by computing the answer to L in polynomial time and outputting a fixed graph with or without Hamiltonian path), but it does not mean that polynomial time solvable problems are NP-complete. – sdcvvc Dec 04 '11 at 02:05
  • So instead of showing that HAM can solve this, I have to show that this can solve HAM, and I need to show how to transform HAM into a problem with edge weights and a simple path of weight >= k? – Garrett Dec 04 '11 at 02:16
  • 1
    @Garrett: Yes. If you can show that, the problem at hand is as hard as HAM. – Anders Lindahl Dec 04 '11 at 06:43
2

The part about the mismatch between cycles and paths is correct and is a problem you need to solve. Basically you need to prove that the Hamiltonian Path problem is also NP complete (a relatively straightfoward reduction to the Cycle problem)

As for the other part, you are doing things in the wrong direction. You need to show that your more complicated problem can solve the Hamiltonian Path problem (and is thus NP-hard). To do this you just basically have to use the special case of unit-cost edges.

hugomg
  • 68,213
  • 24
  • 160
  • 246