Given an n by n matrix M, at row i and column j, I\'d like to iterate over all the neighboring values in a c
Since it was mentioned that the order of the points do not matter, I've simply ordered them by the angle (arctan2) in which they appear at a given radius. Change N to get more points.
from numpy import *
N = 8
# Find the unique distances
X,Y = meshgrid(arange(N),arange(N))
G = sqrt(X**2+Y**2)
U = unique(G)
# Identify these coordinates
blocks = [[pair for pair in zip(*where(G==idx))] for idx in U if idx
Gives for N=8:

More points N=16 (sorry for the colorblind):

This clearly approaches a circle and hits every grid point in order of increasing radius.
