The nearest neighbour algorithm was one of the first algorithms used to determine a solution to the travelling salesman problem, and usually comes to within twenty percent of the optimal route. It is, however, a lot faster than testing every route.
These are the steps of the algorithm:
1. Make two sets of nodes, set A and set B, and put all nodes into set B 2. Put your starting node into set A 3. Pick the node which is closest to the last node and is not in set A; put this node into set A 4. Repeat step 3 until all nodes are in set A