%
% transpositionen.tex -- Darstellung eines Zyklus aus Transpositionen
%
% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
%
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{times}
\usepackage{txfonts}
\usepackage{pgfplots}
\usepackage{csvsimple}
\usetikzlibrary{arrows,intersections,math}
\begin{document}
\def\skala{1}

\def\kreuz#1#2#3{
	\draw[->] ({(#1)-1},#2) to[out=-90,in=90] ({#1},{#2-1});
	\draw[->] ({#1},#2) to[out=-90,in=90] ({#1-1},{#2-1});
	\node at ({(#1)-0.5+0.2},{#2-0.5}) [right] {$#3$};
}
\begin{tikzpicture}[>=latex,thick,scale=\skala]
\foreach \x in {1,2,3,6,7,8,9}{
	\fill ({\x-1},0) circle[radius=0.05];
}
\foreach \x in {1,2,3}{
	\node at ({\x-1},0) [above] {$\tiny \x$};
}
\node at (8,0) [above] {$\tiny k$};
\node at (7,0) [above] {$\tiny k-1$};
\node at (6,0) [above] {$\tiny k-2$};
\node at (5,0) [above] {$\tiny k-3$};
\foreach \x in {1,2,3,4,7,8,9}{
	\fill ({\x-1},-8) circle[radius=0.05];
}
\foreach \x in {1,2,3,4}{
	\node at ({\x-1},-8) [below] {$\tiny \x$};
}
\node at (6,-8) [below] {$k-2$};
\node at (7,-8) [below] {$k-1$};
\node at (8,-8) [below] {$k$};

\foreach \x in {3,3.2,...,5}{
	\fill (\x,{-8+\x}) circle[radius=0.02];
	\fill ({\x+0.5},-8) circle[radius=0.02];
	\fill ({\x-0.5},0) circle[radius=0.02];
}

\kreuz{8}{0}{\tau_{k-1,k}}
\kreuz{7}{-1}{\tau_{k-2,k-1}}
\kreuz{6}{-2}{\tau_{k-3,k-2}}
%\kreuz{5}{-3}{\tau_{56}}
%\kreuz{4}{-4}{\tau_{45}}
\kreuz{3}{-5}{\tau_{34}}
\kreuz{2}{-6}{\tau_{23}}
\kreuz{1}{-7}{\tau_{12}}

\draw[->,color=gray] (0,0) -- (0,-7);
\draw[->,color=gray] (1,0) -- (1,-6);
\draw[->,color=gray] (2,0) -- (2,-5);
%\draw[->,color=gray] (3,0) -- (3,-4);
%\draw[->,color=gray] (4,0) -- (4,-3);
\draw[->,color=gray] (5,0) -- (5,-2);
\draw[->,color=gray] (6,0) -- (6,-1);

\draw[->,color=gray] (8,-1) -- (8,-8);
\draw[->,color=gray] (7,-2) -- (7,-8);
\draw[->,color=gray] (6,-3) -- (6,-8);
%\draw[->,color=gray] (5,-4) -- (5,-8);
%\draw[->,color=gray] (4,-5) -- (4,-8);
\draw[->,color=gray] (3,-6) -- (3,-8);
\draw[->,color=gray] (2,-7) -- (2,-8);
	
\fill (6,-1) circle[radius=0.05];
\fill (7,-1) circle[radius=0.05];
\fill (8,-1) circle[radius=0.05];

\fill (5,-2) circle[radius=0.05];
\fill (6,-2) circle[radius=0.05];
\fill (7,-2) circle[radius=0.05];

%\fill (4,-3) circle[radius=0.05];
\fill (5,-3) circle[radius=0.05];
\fill (6,-3) circle[radius=0.05];

%\fill (3,-4) circle[radius=0.05];
%\fill (4,-4) circle[radius=0.05];
%\fill (5,-4) circle[radius=0.05];

\fill (2,-5) circle[radius=0.05];
\fill (3,-5) circle[radius=0.05];
%\fill (4,-5) circle[radius=0.05];

\fill (1,-6) circle[radius=0.05];
\fill (2,-6) circle[radius=0.05];
\fill (3,-6) circle[radius=0.05];

\fill (0,-7) circle[radius=0.05];
\fill (1,-7) circle[radius=0.05];
\fill (2,-7) circle[radius=0.05];

\end{tikzpicture}
\end{document}

