The Traveling Salesman Problem

Glossary of Terms

Complete Graph: A graph in which every pair of vertices is joined by exactly one edge.
Hamilton Circuit: A circuit that visits every vertex of a graph exactly once.
Hamilton Path: A path that visits every vertex of a graph exactly once.
KN: The complete graph on N vertices. Note: there is only one for each N=1, 2, 3, ...
Traveling Salesman Problem (TSP): Given a complete weighted graph, this problem tells you to find an optimal Hamilton circuit. That is, a Hamilton circuit with the least total weight.
Weighted Graph: A graph where each edge is given a number known as a weight.

Algorithms

Algorithm 1: The Brute Force Algorithm. Notes:

It is important to remember that KN has a total of (N-1)! Hamilton circuits. That can be a lot!! (Remember you calculate (n)! as (n)*(n-1)*(n-2)* ... *(3)*(2)*(1). Example: 5!=5*4*3*2*1=120.)








Algorithm 2: The Nearest Neighbor Algorithm. Notes:








Algorithm 3: The Repetitive Nearest Neighbor Algorithm. Notes:






Algorithm 4: The Cheapest Link Algorithm. Notes:





























Examples



Example 1: Complete graphs.

Example 2:
































Example 3:

























Example 4: