The travelling salesman problem is a computational graph traversal optimisation problem. We have a finite set of cities and weights between the cities . A solution to the problem is a tuple of cities that “visits” all cities and returns to the beginning while minimising the travel length.

The problem is NP-hard and belongs to the class of NP-complete problems. Like other NP-complete problems, we use heuristics to get a better sub-optimal solution in less time.