I'm going to draw a circular diagram like the follwoing:

\begin{scope}[node distance=2mm]
>=stealth, auto,
every state/.style={draw=none,circle,node distance = 10cm}
\node[] (q1) {$1$};
\node[] (q2) [above right=of q1] {$a$};
\node[] (q3) [above right=of q2] {$ab$};
\node[] (q4) [below right=of q3] {$aba$};
\node[] (q5) [below right=of q4] {$(ab)^2$};
\node[] (q8) [below right=of q1] {$b$};
\node[] (q7) [below right=of q8] {$(ab)^3$};
\node[] (q6) [above right=of q7] {$(ab)^2a$};
\begin{scope}[bend left]%
\path[->]   (q1) edge node {} (q2)
(q2) edge node {} (q3)
(q3) edge node {} (q4)
(q4) edge node {} (q5)
(q6) edge node {} (q5)
(q6) edge node {} (q7)
(q7) edge node {}(q8)
(q8) edge node { } (q1);

But the result is not symmetric. How can I modify it in order to get symmetric diagram?


You could use polar coordinates ((<angle>:<radius>)) to place the nodes on a circle, instead of using the relative positioning. I used a loop in the code below, which shortens the code a bit.

enter image description here


\foreach [count=\i] \txt in {1,a,ab,aba,(ab)^2,(ab)^2a,(ab)^3,b}
   \node (q\i) at (-360/8*\i - 135: 2cm) {$\txt$};

\path[->, bend left=12]
  (q1) edge (q2)
  (q2) edge (q3)
  (q3) edge (q4)
  (q4) edge (q5)
  (q5) edge (q6)
  (q6) edge (q7)
  (q7) edge (q8)
  (q8) edge (q1);
| improve this answer | |
  • How can i add a label in the middile of an edge? – babgen May 11 '18 at 9:05
  • @babgen The way you did in your original code. (I removed all the node {} after each edge, because empty nodes don't do anything.) If you want the label to interrupt the arrow, use e.g. (q1) edge node [fill=white] {a} (q2), if you want the label next to the arrow use e.g. (q2) edge node [above] {b} (q3) (alternatives to above: left, right, below, above right, etc.). – Torbjørn T. May 11 '18 at 9:22
  • thaank you so much – babgen May 11 '18 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.