Skip to main content
. 2020 Nov 3;20(21):6270. doi: 10.3390/s20216270
Algorithm 6 Next node selection in the solution to the traveling salesman problem (TSP)
Require: NodeTSP, the reference node’s ID idRef
Ensure: nodenext
1: function Find-Next-Node-In-TSP-Solution(NodeTSPnodeRef)
2:     Nodeorderedsort_node_ascendNodeTSP
3:     posReffind_node_position_in_node_arrayNodeordered,idRef
4:     if posRef<N then N: the number of components in Nodeordered
5:         nodenextposRef+1th component of Nodeordered
6:     else
7:         nodenext the first component of Nodeordered
8:     end if
9:     return nodenext
10: end function