neigh_index: Previous, current, and next positions of a given index in a
cycle.
Description
Previous, current, and next positions of a given index in a cycle.
Usage
neigh_index(i, n)
Value
A three component vector c(previous, current, next)
Arguments
i
Position in a cycle
n
Length of the cycle
Author
Cesar Asensio
Details
Given some position i in a n-length cycle, this function returns
the triple c(i-1,i,i+1) taking into account that the next
position of i=n is 1 and the previous position of i=1 is n.
It is used to perform a 4-exchange in a cycle.