What is the
"Traveling Salesman Problem"?
It is a problem of finding the shortest route between cities. You need to visit each city at least once and return home.


Exhaustive Search Method

Nearest Neighbor Method

Improved Nearest Neighbor Method
Exhaustive Search Method

This method involves checking all possible combinations and choosing the optimal one. The solution is precise but not the fastest. For example, if there are more than 66 cities, it would take the computer several billion years to find the correct answer.
Nearest Neighbor Method

Route points are sequentially included in the route, with each subsequent point being the nearest to the last selected point among all others not yet included in the route.
Improved Nearest Neighbor Method

From each vertex, a path is laid using the nearest neighbor method, then the optimal route is chosen from all routes.
Number of cities:
Method
Distance matrix: