4

Are there bubblesort-esque algorithms for sorting on arbitrary graphs?

I'm working on a problem in which $k$ robots are placed randomly on a graph and have to reach their respective goals as quickly as possible. The robots can only move one step at a time and no two robots can simultaneously occupy the same node, but adjacent robots are allowed to swap places. The analogy to bubble sort when $k = |V|$ and the graph is a line is almost perfect (the one difference is that I care more about the total time it takes in the real world for the robots to move and sort themselves, the makespan, rather than the number of comparisons or runtime per se. (It would also be nice to minimize the average time for a robot to get to its goal without later being displaced.)

I can prove an $O(k^2+kn)$ bound for the makespan using a simple algorithm in which the robots greedily follow shortest paths to their goals and where robot $x$ only swaps robot $y$ if $y$ is in $x$'s way and y is already at its own goal. But parallel bubblesorting an array takes only $O(n)$ time, and shearsort only takes $O(n^{1/2}\log n)$ time, so I feel like there should be a simple algorithm that is (provably) linear. I would be very happy with a linear result, even if it was just for gridlike graphs (graphs obtained by deleting nodes from grids, thus creating hallways and side rooms etc.), or for trees.

Raphael
  • 73,212
  • 30
  • 182
  • 400

0 Answers0