# circular ranked lists

I have two lists which are circular, in that given list

['A','B','C','D','E']

'A' and 'E' are the same distance apart as 'A' and 'B' and so on.

Given I have rankings

R1=['A','B','C','D','E']

R2=['E','A','B','C','D']

how can I compute their similarity or distance?

• What are 'A','B','C','D','E'? Real numbers? Integers? Matrices? – Vladislav Gladkikh Mar 30 '20 at 3:24
• they are categorical variables representing colors for example. – ha554an Mar 30 '20 at 13:42

## 1 Answer

The variables $$A$$, $$B$$, $$C$$, $$D$$, and $$E$$ can be encoded as points on a circle $$S^1$$ that is by angles between $$0$$ ans $$2\pi$$ if you measure the angles in radians. Vectors $$R_1$$ and $$R_2$$ are thus points on a five-dimensional torus $$T^5=\underbrace{S^1\times ...\times S^1}_\text{5}$$ The distance $$d_{12}$$ between $$R_1$$ and $$R_2$$ is the distance between these points on the torus $$T^5$$.

It's more convenient to measure the angles on your circles in $$2\pi\cdot\mathrm{radians}$$. Then $$A$$, $$B$$, $$C$$, $$D$$, and $$E$$ are real numbers $$x_1, ..., x_5$$ all between $$0$$ and $$1$$. Then $$R_1=(x_{11},..., x_{15})$$, $$R_2=(x_{21},..., x_{25})$$, and

$$d_{12} = \sum\limits_{i=1}^{5}s_i,$$ where $$$$s_i = \begin{cases} |x_{2i}-x_{1i}|, & \text{if |x_{2i}-x_{1i}|\leq 0.5}\\ 1-|x_{2i}-x_{1i}|, & \text{if |x_{2i}-x_{1i}| > 0.5} \end{cases}$$$$

An explanation of this formula for a two-dimensional torus is given here: link.