Hello!

I'm not quite understanding this idea of inversions. I know that if $\displaystyle \pi$ is a permutation, then a pair $\displaystyle (i,j)$ is an inversion if $\displaystyle (i-j)(\pi (i)- \pi (j))<0$.

The graph of $\displaystyle \pi$ has $\displaystyle i$ and $\displaystyle j$ as adjacent iff $\displaystyle (i,j)$ is an inversion.

I think I understand that. I have this big problem though:

Suppose $\displaystyle \pi=(1234)$. These are the points $\displaystyle 1,2,3,4$ connected in a square shape. Clearly $\displaystyle 1$ and $\displaystyle 2$ are adjacent.

But, the formula gives for $\displaystyle (1,2)$ (this is just a pair, it isn't permutation notation?), $\displaystyle (1-2)(2-3)>0$.

I can't see why this is wrong, $\displaystyle \pi(1)=2$ and $\displaystyle \pi(2)=3$ since we're just following the path around the square.

Can someone explain why this is wrong?