@@ -65,7 +65,7 @@ Recently, we worked on a project for routing quantum information,

if you're interested you can read the paper at~\cite{Bapat2020}.

Here, we will try to abstract away the underlying quantum operations and operate at a higher level of routing.

\paragraph{The Problem:} We will consider the path graph $P_n=(V,E)$ in this project,

\paragraph{The problem:} We will consider the path graph $P_n=(V,E)$ in this project,

i.e., vertices $1,\dots,n$ connected as

\begin{tikzpicture}

\graph{ 1 -- 2 -- "$\dots$" -- n };

...

...

@@ -74,23 +74,22 @@ We assign each node $i\in V$ a \emph{token}, with a destination $\pi(i)$ given b

To get the token at node $i$, we define $t(i)$ as the token at node $i$ and,

in an abuse of notation, let $\pi(t(i))$ be the destination of that token. The goal is to route each token to its destination.

\paragraph{The Model:} We can route tokens by performing \emph{reversals},

\paragraph{The model:} We can route tokens by performing \emph{reversals},

which exchange locations of tokens.

A reversal $\rev{i,j}$, for $i,j \in V$ and $i\leq j$, performs transpositions $\prod_{k=0}^{(j-i)/2}

\begin{pmatrix} i+k & j-k \end{pmatrix}$ of the tokens.

It is possible to implement any permutation using several reversals,

e.g., one could order tokens starting from the token at node 1 by performing $\rev{1,\pi(t(1))}$,

$\rev{2,\pi(t(2))}$, etc.

Each reversal needs an amount of time to be implemented%

\footnote{The time is the number of swap gates that can be performed in the quantum model in the same amount of time.},

namely

A reversal $\rev{i,j}$ needs an amount of time%

\footnote{The time is the number of swap gates that can be performed in the quantum model in the same amount of time.}

\begin{equation}

c(n) \coloneqq\sqrt{{(n+1)^2} - p(n)} / 3\,,

c(n) \coloneqq\sqrt{{(m+1)^2} - p(m)} / 3

\end{equation}

where$p(n)\coloneqqn\pmod{2}$ is the parity of $n$.

This is a bit of a mouthful to work with, so it may help to simply approximate this by $(n+1)/3$.

to be implemented, where $m=|j-i|+1$ is the number of nodes in the reversed segment, and$p(m)\coloneqqm\pmod{2}$ is the parity of $m$.

This is a bit of a mouthful to work with, so it may help to simply approximate this by $(m+1)/3$.

\paragraph{Our Goals:} We are interested in routing any given permutation $\pi$ in a \emph{time} that is minimal. Note that reversals that do not overlap can be performed simultaneously, i.e. $\rev{i,j}$ and $\rev{k,l}$ with $i<j<k<l$ can be performed in parallel or in one layer of the circuit. The time for a single layer is the time of the slowest operation in that layer. Finally, the time taken to perform the full circuit is a sum of times for each layer in the circuit. So, we have a few goals in this project:

\paragraph{Our goals:} We are interested in routing any given permutation $\pi$ in a \emph{time} that is minimal. Note that reversals that do not overlap can be performed simultaneously, i.e. $\rev{i,j}$ and $\rev{k,l}$ with $i<j<k<l$ can be performed in parallel or in one layer of the circuit. The time for a single layer is the time of the slowest operation in that layer. Finally, the time taken to perform the full circuit is a sum of times for each layer in the circuit. So, we have a few goals in this project:

\begin{enumerate}

\item Design an algorithm (or algorithms!) that given a permutation $\pi$ as input, implements $\pi$ using weighted reversals on the path.

\item Give a bound on the runtime of the algorithm.

...

...

@@ -99,9 +98,16 @@ This is a bit of a mouthful to work with, so it may help to simply approximate t

\end{enumerate}

\section{Warm-up}

Let's simplify the problem. Suppose you can only use neighboring nearest-neighbor reversals (or swaps) to permute tokens, and each swap takes time 1. What is the minimum time necessary to implement any permutation on the path this way?

Note the similarity with sorting. In bubble sort, you make neighboring comparisons and swap if the two neighbors are out of order. Sorting takes $O(n^2)$ operations to sort any list, but our time is measured not in operations but in circuit depth. It turns out that the fastes possible

\paragraph{Routing with swaps:} Let's simplify the problem. Suppose you can only use neighboring nearest-neighbor reversals (or swaps) to permute tokens, and each swap takes time 1. What is the minimum time necessary to implement any permutation on the path this way? Note the close relation to sorting. In fact, the problem is the same: the list indices label the nodes of a path, and the (unsorted) integer at index $i$ labels the token $t(i)$. However, sorting measures time by total number of operations, while our time is measured in circuit depth. In bubble sort, you make neighboring comparisons and swap if the two neighbors are out of order. Sorting takes $O(n^2)$ operations to sort any list, but our time is measured not in operations but in circuit depth. It turns out that the list can be sorted in \emph{time}$n-o(n)$, where a single swap has time cost 1. The best known algorithm for this is the odd-even sort, which you can read about here,~\cite{Knuth1998}.

\begin{enumerate}

\item Check that odd-even sort routes any permutation correctly.

\item Show that using only swap, the worst-case time is at least $n-1$.

\end{enumerate}

\paragraph{Add weighted reversals:} Now, we expand our toolkit to include longer reversals $\rev{i,j}$ that take time $(|j-i|+2)/3$.

\begin{enumerate}

\item How much time does a weighted reversal require in a model that only allows swaps?

\item What is the best possible speed-up achievable over odd-even sort using weighted reversals?