I am implementing an algortihm to find the neighbours of points in multidimensional grids. In 1D a point has two neighbours (left and right), in 2D there are 4 neighbour points (left, right, up, down) and in 3D there are 6. Now the figurative imagination comes to an end. How many neighbors does a point have in $N$ dimensions?
Is it just $2N$ ?
Let's say the grid is $\Bbb Z^n$ and let your point be $(p_1,p_2,\cdots,p_n)$. The adjacent vertices are the verices $(x_1,\cdots, x_n)$ such that:
Therefore, there are exactly $2n$ such vertices in the grid.