Sorting array of distances by proximity to each other
Although it's hard to discern a precise question here, evidently it concerns spatial data structures for efficient local searches of objects.  Hanan Samet's books on the subject are classics and almost encyclopedic.  He wrote a brief overview of the subject available here.  I suspect a simple quadtree would be an attractive solution.  In many cases, exploiting a pre-sorting by one of the coordinates provides fine performance and is simple to code.