Adds neighbour logic to the matrix to find actual neighbors of points.