Traveling Salesman Problem .. MST or not?

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
LithiumDex
New poster
Posts: 44
Joined: Tue Jun 06, 2006 6:44 pm
Location: Nova Scotia, Canada
Contact:

Traveling Salesman Problem .. MST or not?

Post by LithiumDex »

I've heard this problem is NP Complete, but looking at it... it seems like it could be solved with a simple minimum spanning tree algorithm -- can someone explain this?
- Chris Adams
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

It is an NP complete problem!!

Can you explain your simple MST approach? :-?
LithiumDex
New poster
Posts: 44
Joined: Tue Jun 06, 2006 6:44 pm
Location: Nova Scotia, Canada
Contact:

Post by LithiumDex »

Don't we just have an undirected graph of N nodes, each edge having a weight? Why would you think MST would fail for this?
- Chris Adams
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

Travelling Salesman Problem
Given N nodes and the costs of the edges between every pair of nodes, what is the cheapest round-trip route that visits every node exactly once and then returns to the starting node?

Minimum Spanning Tree
Given a graph consiting of N nodes, find a connected subgraph which has N-1 edges and sum of these edges is minimized.

So these two things aren't exactly identical. The degree of every node in the subgraph of a TSP is exactly 2, but this isn't true for the subgraph of a MST.
Last edited by sohel on Mon Apr 23, 2007 8:57 pm, edited 1 time in total.
LithiumDex
New poster
Posts: 44
Joined: Tue Jun 06, 2006 6:44 pm
Location: Nova Scotia, Canada
Contact:

Post by LithiumDex »

I understand, thanks.
- Chris Adams
stubbscroll
Experienced poster
Posts: 151
Joined: Tue Nov 16, 2004 7:23 pm
Location: Norway
Contact:

Post by stubbscroll »

Actually, MST can be used (as part of the algorithm) to approximately solve TSP when the triangle inequality holds for the graph.

http://en.wikipedia.org/wiki/Travelling ... cial_cases
Post Reply

Return to “Algorithms”