next_index: Next position to i in a cycle

View source: R/10-grafos-TSP.R

next_indexR Documentation

Next position to i in a cycle

Description

Next position to i in a cycle.

Usage

next_index(i, n)

Arguments

i

Position in cycle

n

Lenght of cycle

Details

In a cycle, the next slot to the i-th position is i+1 unless i=n. In this case, the next is 1.

Value

The next position in cycle

Author(s)

Cesar Asensio

Examples

next_index(5, 7)   # 6
next_index(7, 7)   # 1


gor documentation built on May 4, 2023, 1:06 a.m.

Related to next_index in gor...