Any suggestions for starting doing this kind of neighbour list?

Here is one quick go at something like this…

julia> grid = [Set{Int}() for x=1:5, y=1:5];

julia> data = [(x=1+4*rand(), y=1+4*rand(), n=n) for n in 1:30];

julia> insert(grid) = p -> push!(grid[trunc(Int, p.x), trunc(Int, p.y)], p.n);

julia> foreach(insert(grid), data)

julia> grid
5×5 Array{Set{Int64},2}:
 Set([23])          Set([])                 Set([26, 30])    Set([4, 27, 28, 15])  Set([])
 Set([24, 16, 20])  Set([9, 14, 10, 6, 1])  Set([3, 17, 8])  Set([5, 21])          Set([])
 Set([19, 22])      Set([7, 25])            Set([18])        Set([2, 29])          Set([])
 Set([13])          Set([11, 12])           Set([])          Set([])               Set([])
 Set([])            Set([])                 Set([])          Set([])               Set([])
5 Likes