How to Use the Nearest Neighbour Algorithm
Edited by Caidoz, Flickety, Livorde, Marysharyclary and 5 others
The nearest neighbour algorithm works in a similar way to Prim's algorithm, but instead of finding a tree you find a path around your graph/network.
Edit Steps
-
1Choose a node.Ad
-
2From that node choose the arc of least weight joining it to another node.
-
3From the node you have connected to (not the one you started off with), find the arc of least weight which will not create a cycle (loop) and add it to your path.
-
4Continue in this manner until all of the nodes are connected.
-
5Once all of the nodes are connected, join the first and last node with the minimum arc connecting them, and this completes the cycle around your network.Ad
Edit Warnings
Article Info
Thanks to all authors for creating a page that has been read 9,573 times.