1

I have a US spatial map connecting cities with weights (distances). I'd like to find the longest (most weighted) trail in this map.

  • each edge is visited 0 or 1 times
  • each node can be visited [0, inf) times.

There's NO requirement that all the nodes or the edges need to be visited.

Method and prolog resources suggestions would be fine.

aladagemre
  • 592
  • 5
  • 16
  • 1
    Sounds like travelling salesman – Flexo Dec 03 '11 at 15:08
  • But we don't need to visit all the cities in this problem. – aladagemre Dec 03 '11 at 15:47
  • You don't want to visit all the cities, but you want to visit as many of the edges as possible, since that's where the constraints are. Think of your edges as cities and it becomes travelling salesman again. – Flexo Dec 03 '11 at 16:42
  • I just thought that way seconds ago, but now I see travelling salesman wants to visit all the cities (in this case all the edges) but this problem is a relaxed version of it. Is there a way to solve TSP such that "all cities" constraint is removed? – aladagemre Dec 03 '11 at 16:47

1 Answers1

2

I do not know whether I am correct but you could try the following:

  1. You can check if the graph is Eulerian. If so your problem is to find the euler circuit, which can done in polynomial time.

  2. Otherwise you have a problem, because if I am not wrong you have to find the maximum (possibly induced) Eulerian sub-graph, which is NP-hard.

Of course, everything is assuming that all weights are non-negative.

falsetru
  • 357,413
  • 63
  • 732
  • 636
Arnab
  • 21
  • 2