neigh_index {gor}R Documentation

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)

Arguments

i

Position in a cycle

n

Lenght of the cycle

Details

Given some position i in a n-lenght 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.

Value

A three component vector c(previous, current, next)

Author(s)

Cesar Asensio

Examples

neigh_index(6, 9)  # 5 6 7
neigh_index(9, 9)  # 8 9 1
neigh_index(1, 9)  # 9 1 2


[Package gor version 1.0 Index]