The neighborhood function for a simple linear topology where every particle has k = 2 neighbors
pso.neighborhood.K2(i, n)
i
The particle position
n
the size of particle population