I have a question about assigning values to nodes laid out in a physical space:

- There is a set of N fixed nodes spread out throughout a certain 2 dimensional region that need to be assigned a value from 1 to M. In this case, M is less than N. Preferably, nodes that have the smallest distance between one another should be assigned the furthest possible values (e.g., for the two nodes closest to each other, one should not be assigned a value of “5” or “7” if the other is assigned a “6”. Instead, one should be assigned a “1” and the other an “M” if at all possible). As the distance between nodes increase, the assigned values may get closer (and eventually the two nodes furthest from each other would have to be assigned the same value).
- There may be mobile nodes that move in and out of this region, and a calculation would need to be remade whenever this happens.

I should note that the nodes are not uniformly spaced. Are there any existing algorithms that can address this problem and create the optimum setup?

Edit: Added the fact that the region is 2 dimensional.

5