Neural Network Realization of the Nearest Neighbor Method