Create neighborhood matrix