Picking the nearest object in the same family can be confusing, as you have sometimes a hard time finding what element you are currently manipulating.
I did an example : [attachment=0:fadaxu3a][/attachment:fadaxu3a]
In this example, I find the nearest element in the same family for each element of the family. To illustrate it, I then make each ball move to this nearest ball.
You can drag an drop balls to test this, and hit the button to trigger the calculation an movement.
Events are heavily commented for complete explanation on the method.
I hope this was what you needed