1

I'm having a trouble finding a contradicting example of the next variation of the TSP problem.

Input: G=(V,E) undirected complete graph which holds the triangle inequality, w:E->R+ weight function, and a source vertex s.

Output: Simple Hamilton cycle that starts and ends at s, with a minimum weight.

Algorithm:

1. S=Empty-Set   
2. B=Sort E by weights.   
3. Initialized array M of size |V|, 
   where each cell in the array holds a counter (Initialized to 0)
   and a list of pointers to all the edges of that vertex (In B).    

4. While |S|!=|V|-1  
    a. e(u,v)=removeHead(B).  
    b. If e does not close a cycle in S then     
          i.    s=s union {e}   
         ii.    Increase degree counter for u,v.  
        iii.    If M[u].deg=2 then remove all e' from B s.t e'=(u,x).   
         iv.    If M[v].deg=2 then remove all e' from B s.t e'=(v,x).

5. S=S union removeHead(B).

This will be done similar to the Kruskal Algorithm (Using union-find DS).
Steps 4.b.iii and 4.b.iv will be done using the List of pointers.

I highly doubt that this algorithm is true so I instantly turned into finding why it is wrong. Any help would be appreciated.

Community
  • 1
  • 1
Zionsof
  • 1,196
  • 11
  • 23
  • If I understand the algorithm, due to the condition `If e does not close a cycle in S` makes it impossible to finally chose an edge which closes the desired cycle. Is that right? – Codor Jul 13 '16 at 13:13
  • 1
    It should be quite easy to find an example where the edge with minimum weight is not part of a shortest cycle. – Henrik Jul 13 '16 at 13:37

3 Answers3

0

Lets say we have a graph with 4 vertices (a, b, c, d) with edge weights as follows:

w_ab = 5
w_bc = 6
w_bd = 7
w_ac = 8
w_da = 11
w_dc = 12

             7
       |--------------|
   5   |   6      12  |
a ---- b ---- c ----- d
|______________|      |
|      8              |
|_____________________|
      11

The triangle inequality holds for each triangle in this graph.

Your algorithm will choose the cycle a-b-c-d-a (cost 34), when a better cycle is a-b-d-c-a (cost 32).

Abhishek Bansal
  • 12,589
  • 4
  • 31
  • 46
0

Your procedure may not terminate. Consider a graph with nodes { 1, 2, 3, 4 } and edges { (1,2), (1,3), (2,3), (2,4), (3,4) }. The only Hamiltonian cycle in this graph is { (1,2), (1,3), (2,4), (3,4) }. Suppose the lowest weighted edge is (2,3). Then your procedure will pick (2,3), pick one of { (1,2), (1,3) } and eliminate the other, pick one of { (2,4), (3,4) } and eliminate the other, then loop forever.

Nuances like this are what makes the Travelling Salesman problem so difficult.

PMar
  • 1
0

Consider the complete graph on 4 vertices, where {a,b,c,d} are the nodes, imagined as the clockwise arranged corners of a square. Let the edge weights be as follows.

w({a,b}) := 2, // "edges"
w({b,c}) := 2,
w({c,d}) := 2,
w({d,a}) := 2,
w({a,c}) := 1, // "diagnoals"
w({b,d}) := M

where M is an integer larger than 2. On one hand, the hamiltonian cycle consisting of the "edges" has weight 8. On the other hand, the hamiltonian cycle containing {a,c} , which is the lightest edge, must contain {b,d} and has total weight

1 + M + 2 + 2 = 5 + M > 8

which is larger than the minimum possible weight. In total, this means that in general a hamitonian cycle of minimum weight does not necessarily contain the lightst edge, which is chosen by the algorithm in the original question. Furthermore, as M tends to infinity, the algorithm performs arbitrarily badly in terms of the approximation ratio, as

(5 + M) / 8

grows arbitrarily large.

Codor
  • 17,447
  • 9
  • 29
  • 56