fast_tsp.greedy_nearest_neighbor

fast_tsp.greedy_nearest_neighbor(dists)

Solve the TSP using the greedy nearest neighbor algorithm.

Solve TSP using the greedy nearest neighbor heuristic. This is a very rough approximation to the exact solution. The preferred way is to use find_tour.

Parameters:

dists (Union[List[List[int]], ndarray]) – The distance matrix.

Return type:

List[int]

Returns:

The tour computed by the nearest neighbor algorithm.