How can I place the loop of vertex {q_1, q_2, q_3} and vertex {empty set} above and below these vertices, respectively (as in the drawing below), instead of on the right?
This is my .TEX:
\documentclass[tikz,12pt,border=1mm]{standalone} \usetikzlibrary{automata} \usepackage{amssymb} \begin{document} \begin{tikzpicture}[ ->, >=stealth, node distance=3cm, every state/.style={thick, fill=gray!10}, initial text={$I$}, ] \node[state, initial](Q1) at (0,0) {$\{q_1\}$}; \node[state,accepting] (Q3) at (6,0) {$\{q_4\}$}; \node[state] (V) at (0,-3) {$\varnothing$}; \node[xscale=2, transform shape,state] (Q2) at (3,0) {% \scalebox{0.5}[1]{$\{q_1,q_2,q_3\}$}}; \draw (Q1) edge [above] node {$a$} (Q2); \draw (Q1) edge [left] node {$b,c$} (V); \draw (Q2) edge [above] node {$b,c$} (Q3); \draw (Q3) edge [below] node [pos = 0.44,below = 0.2] {$a,b,c$} (V); \draw (V.20) .. controls +(40:3mm) and +(90:2mm) .. ([xshift=3.5mm] V.east) node[right] {$a,b,c$} .. controls +(-90:2mm) and +(-40:3mm) .. (V.-20); \draw (Q2.20) .. controls +(40:3mm) and +(90:2mm) .. ([xshift=3.5mm] Q2.east) node[right] {$a$} .. controls +(-90:2mm) and +(-40:3mm) .. (Q2.-20); \end{tikzpicture} \end{document} Output:





controlskeyword.+(40:3mm)is a relative polar coordinate: 40 degrees counter-clockwise from the ((0,0), (0,1)) “vector”, 3mm of radius (counted from the last point placed so far on the path). You also need to change the anchors saying where the small loops start from and end at:(Q2.20)is an anchor located on the border of node(Q2)at polar angle 20 degrees.