Guest User

Untitled

a guest
Feb 2nd, 2013
565
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \documentclass{article}
  2. \usepackage{tikz}
  3. \usepackage{amsmath,amssymb}
  4. \usepackage{ifthen}
  5. \usetikzlibrary{arrows,positioning,decorations.pathreplacing,shapes}
  6. \usetikzlibrary{snakes}
  7.  
  8.  
  9. \begin{document}
  10.  
  11. \parindent=0em
  12.  
  13. \begin{center}
  14. \begin{tikzpicture}
  15.  
  16. \def\n{7} %nombre de sommets du graphe
  17.  
  18. %%%%% Dessin des sommets %%%%%
  19. \pgfmathtruncatemacro{\nmoinsun}{\n-1}
  20.  
  21.  
  22.  
  23. \foreach \x in {0,...,\nmoinsun}
  24. \node[circle, very thick, draw=black, fill=red!25] (\x) at (270 + \x * 360/\n:3) {$\x$};
  25.  
  26.  
  27. %%% Dessin des flèches noires %%%
  28.  
  29. \foreach \y in {0,...,\nmoinsun}
  30. \pgfmathtruncatemacro{\z}{mod(\y +1, \n)}
  31. \draw[-triangle 45] (\y) to (\z);
  32.  
  33.  
  34. %%%% Dessin des flèches bleues %%%%
  35.  
  36.  
  37. \foreach \u in {1,...,\nmoinsun}
  38. \pgfmathtruncatemacro{\v}{mod(\u * 10,\n)}
  39. \pgfmathtruncatemacro{\vplusun}{\v+1}
  40. \pgfmathtruncatemacro{\uplusun}{\u+1}
  41. \ifthenelse{\uplusun=\v}
  42. {\draw[-latex, blue, thick, dotted] (\u) to[bend right=45] (\v);}
  43. {\ifthenelse{\vplusun=\u}
  44. {\draw[-latex, blue, thick, dotted] (\u) to[bend left=45] (\v);}
  45. {\draw[-latex, blue, thick, dotted] (\u) edge (\v);};};
  46.  
  47.  
  48.  
  49.  
  50. \draw[-triangle 45] (4,1) -- node[above]{$+1 \mod [\n]$} (6.5,1) ;
  51. \draw[-latex, blue, thick, dotted] (4,0) -- node[above]{$\times 10 \mod [\n]$} (6.5,0) ;
  52.  
  53. \end{tikzpicture}
  54. \end{center}
  55.  
  56. \end{document}
RAW Paste Data