Good question.
First you need to generate a list of the following data on each draggable:
- The X position
- The Y position
- The Height
- The Width
When defining objects as draggable you may bind a callback to the "drag" event. This event is triggered to fire if the draggable is moved 1 pixel. Meaning this callback will be called alot so it is key to keep calculations to a minimum.
When the callback is called you will get supplied with the ui and event objects. The ui object will contain valuable X and Y positioning data on the draggee.
With the dimensions and position of the draggee and the other draggables you can easely calculate the proximity to its sibblings and act accordingly. With the available data you should be able to implement akellehe's math.
Before I forget, you have to recalculate the position list on the draggable stop event.
Edit: check the following link on draggable it contains the documentation on the draggable events, methods and values.