Skip to main content

Traveling Salesman Problem

The Traveling Salesman Problem asks for the shortest route that visits each city exactly once and returns to the starting city. In combinatorics, it shows how hard route and cycle optimization can get in graphs.

Last updated July 2026•Fiveable Content Team

What is the Traveling Salesman Problem?

The Traveling Salesman Problem, or TSP, is a combinatorics optimization problem where you look for the shortest possible route through a set of cities, visiting each one exactly once and then returning to where you started. In graph language, you can think of the cities as vertices and the travel costs as weighted edges.

The basic setup is simple, but the search space grows fast. If you have only a few cities, you can list possible tours and compare their total lengths. Once the number of cities gets larger, the number of possible routes explodes, so checking every route becomes unrealistic. That is why TSP is one of the most famous examples of a problem that is easy to state but hard to solve efficiently.

A useful way to connect TSP to graph theory is through Hamiltonian cycles. A Hamiltonian cycle visits every vertex exactly once and returns to the start, which matches the shape of a TSP route. The difference is that TSP adds weights, so you are not just asking whether a cycle exists, you are asking which cycle has the smallest total cost. That extra optimization step is what makes the problem so rich in combinatorics.

TSP is also tied to computational complexity. It is NP-hard, which means no fast algorithm is known for solving every large instance exactly. For small graphs, you might use dynamic programming or integer linear programming to find the true best route. For bigger graphs, classes of heuristics like nearest neighbor or approximation methods such as Christofides algorithm give a route that is good enough even if it is not perfectly optimal.

A tiny example makes the setup clearer. If four cities have distances arranged so that one tour is A to B to C to D to A, you compute the total by adding the four edge weights. Then you compare it with the other possible tours that start and end at A. The winning route is the one with the lowest sum, not the one with the fewest edges, since every valid tour uses the same number of edges anyway.

Why the Traveling Salesman Problem matters in COMBINATORICS

Traveling Salesman Problem shows up whenever a combinatorics problem turns into a search for the best arrangement, not just any arrangement. It is a clean example of how graph theory, optimization, and counting all meet in one place. If you can frame TSP correctly, you are already thinking in the language of weighted graphs and cycles.

It also gives you a realistic picture of what “hard” means in discrete math. Some problems are hard because the counting is messy. TSP is hard because the number of possible tours grows so quickly that brute force stops being practical. That idea comes up again in network design, delivery routing, chip design, and scheduling, where the math has to balance accuracy against time.

In a combinatorics class, TSP is often the problem that helps separate two skills: recognizing a Hamiltonian-style structure and deciding whether you need an exact answer or a good approximation. That distinction matters when you solve graph problems, because not every route question is asking the same thing. Some ask for existence, some ask for shortest length, and some ask for a method that gets close fast.

TSP also gives you a strong example of why algorithms matter in discrete math. A route can be described with a few symbols, but finding the best route can be computationally expensive. That contrast is a big part of modern combinatorics and graph theory.

Keep studying COMBINATORICS Unit 11

Official unit cheatsheet

open one-pager

How the Traveling Salesman Problem connects across the course

Hamiltonian Cycle

A Hamiltonian cycle is the graph-theory backbone of TSP. If you strip away the weights and only ask whether a cycle visits every vertex once, you are looking at a Hamiltonian cycle question. TSP adds the optimization layer, so instead of asking whether a tour exists, you ask which tour has the least total cost.

Graph Theory

TSP is usually modeled with a weighted graph, so graph theory gives you the notation and the structure. Vertices represent cities, edges represent travel distances or costs, and cycles represent complete tours. That setup makes it easier to compare TSP with other graph problems like path finding and cycle detection.

NP-Complete

TSP is a classic example of a problem that becomes computationally difficult as the input grows. In class, that makes it a useful comparison point when you talk about NP-type complexity and why exhaustive search is not realistic for large graphs. It is especially useful for understanding the jump from checking a candidate route to finding the best route.

Held-Karp Algorithm

Held-Karp is one of the best-known exact methods for TSP on small to medium instances. It uses dynamic programming to avoid repeating the same route calculations over and over. If your problem set asks how exact algorithms can still be possible, this is a strong example of a smarter, but still expensive, approach.

Is the Traveling Salesman Problem on the COMBINATORICS exam?

A quiz or problem set item might give you a weighted graph and ask whether it represents a TSP setup, then ask you to find the shortest Hamiltonian cycle among a few possible tours. You may also need to explain why the brute-force method is inefficient once the number of cities increases. If the question includes a real-world scenario, like delivery routing or circuit layout, your job is to recognize that the same optimization idea is being modeled with a graph.

You may also be asked to compare exact and approximate strategies. In that case, name the route you get, total the edge weights carefully, and say whether the method guarantees the absolute best answer or just a good one. The biggest mistake is confusing TSP with a path that visits every vertex and stops. TSP always returns to the start, so the cycle part matters.

The Traveling Salesman Problem vs Hamiltonian Cycle

These are closely related, but not the same. A Hamiltonian cycle is a cycle that visits every vertex exactly once. TSP uses that same kind of cycle, but adds weights and asks for the minimum-total-cost version. If a problem mentions shortest route, cost, or distance, you are in TSP territory.

Key things to remember about the Traveling Salesman Problem

  • The Traveling Salesman Problem asks for the shortest cycle that visits each city exactly once and returns to the start.

  • In combinatorics, TSP is usually modeled with a weighted graph, where cities are vertices and travel costs are edge weights.

  • TSP is hard because the number of possible tours grows very fast, so checking every route is not practical for large graphs.

  • The problem is closely tied to Hamiltonian cycles, but TSP adds the extra step of minimizing total weight.

  • Exact methods work for smaller instances, while heuristics and approximation algorithms are used when the graph gets too big.

Frequently asked questions about the Traveling Salesman Problem

What is Traveling Salesman Problem in Combinatorics?

The Traveling Salesman Problem is the task of finding the shortest possible route that visits each city exactly once and returns to the starting city. In combinatorics, it is studied as a weighted graph optimization problem. It is one of the clearest examples of how a simple counting-style setup can become computationally difficult.

Is Traveling Salesman Problem the same as a Hamiltonian cycle?

Not exactly. A Hamiltonian cycle only asks whether you can visit every vertex once and return to the start. TSP asks for that kind of cycle with the smallest total weight, so it is a more specific optimization problem.

Why is Traveling Salesman Problem considered hard?

Because the number of possible tours grows very quickly as you add cities. That makes brute-force checking unrealistic for large graphs. In class, this is a good example of why combinatorics and algorithm design have to work together.

How do you solve the Traveling Salesman Problem in a class setting?

For small graphs, you can list possible tours and compare their total weights, or use an exact method like dynamic programming. For larger graphs, you usually use a heuristic or approximation algorithm and explain why it is reasonable even if it is not guaranteed to be perfect.