You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
The Travelling Salesman Problem (TSP) asks: what is the shortest route that visits every vertex exactly once and returns to the starting vertex? Unlike the Chinese Postman (which traverses every edge), the TSP visits every vertex. It is one of the most famous problems in mathematics and computer science.
The TSP is an NP-hard problem. For n vertices, there are (n−1)!/2 possible tours (for an undirected complete graph). This grows extremely fast:
| n | Tours |
|---|---|
| 4 | 3 |
| 5 | 12 |
| 10 | 181,440 |
| 20 | >1016 |
For large n, finding the optimal solution by brute force is impractical. Instead, we use bounds and heuristics.
The nearest neighbour algorithm provides an upper bound for the TSP.
Distance matrix for A, B, C, D:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.