Basic k nearest neighbor operator