next up previous
Next: Finding a Happy Clique Up: An Algorithm for Sorting Previous: Happy Cliques

   
Implicit Representation of the Overlap Graph

Note that an explicit representation of the overlap graph uses $\Theta(n^2)$ space, and since the neighborhood of a node may be of size $\Omega(n)$ nodes (and $\Omega(n^2)$ arcs), it seems we need to perform $\Omega(n^2)$ steps per reversal, finally reaching a time bound of $\Omega(n^3)$.

We shall therefore use an implicit representation of the overlap graph, constructed as follows: We assume that the input is given as a sequence of n signed integers representing $\pi^0$. Initially the permutation $\pi=u(\pi^0)$ is constructed as described in Section 10.4.4 and stored in an array. The array holds n intervals and 2n endpoints, thus it is linear in size. We also construct an array representing $\pi^{-1}$. It is straightforward to verify that with these two arrays we can determine, in constant time, for each element in $\pi $ whether it is a left or a right endpoint of a gray edge. In case the element is an endpoint of a gray edge we can also find the other endpoint and check whether the edge is oriented in constant time. Finding whether two edges overlap is also trivial in constant time.

Thus the arrays $\pi $ and $\pi^{-1}$ comprise a representation of $OV(\pi )$. Our algorithm will maintain these two arrays while carrying out the reversals that it finds. The time to update the arrays is proportional to the length of the interval being reversed, which is O(n).

It is easy to produce a list of the intervals in the representation of $OV(\pi )$ sorted by either left or right endpoint from the arrays $\pi $ and $\pi^{-1}$. It is also possible to maintain them without increasing the asymptotic time bound of the algorithm. In practice it may be faster to maintain such lists instead of, or in addition to $\pi $ and $\pi^{-1}$.


next up previous
Next: Finding a Happy Clique Up: An Algorithm for Sorting Previous: Happy Cliques
Peer Itsik
2001-01-17