Попытка расширить циклы в диаграмме NFA

Попытка расширить циклы в диаграмме NFA

Мне нужно сделать стрелки от 9 до 2 и от 12 до 2, но мне нужна помощь в растягивании вокруг других узлов.

\documentclass{article}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows}
\tikzset{
  ->, % makes the edges directed
%>=stealth', % makes the arrow heads bold
node distance=3cm, % specifies the minimum distance between two nodes. Change       if necessary.
every state/.style={thick, fill=gray!10}, % sets the properties for each   'state' node
initial text=$ $, % sets the text that appears on the start arrow
}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2em]

    \node[state, initial, accepting](1){};
    \node[state, right=of 1](2){};
    \node[state, above right=of 2](3){};
    \node[state, right=of 3](4){};
    \node[state,right=of 4](5){};
    \node[state,right=of 5](6){};
    \node[state,right=of 6](7){};
    \node[state,right=of 7](8){};
    \node[state,accepting,right=of 8](9){};
    \node[state, below right =of 2](10){};
    \node[state, right =of 10](11){};
    \node[state, accepting, right=of 11](12){};
\end{tikzpicture}
\end{figure}
\end{document}

решение1

\documentclass{article}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows}
\tikzset{
  ->, % makes the edges directed
>=stealth', % makes the arrow heads bold
node distance=3cm, % specifies the minimum distance between two nodes. Change       if necessary.
every state/.style={thick, fill=gray!10}, % sets the properties for each   'state' node
initial text=$ $, % sets the text that appears on the start arrow
}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2em]

    \node[state, initial, accepting](1){};
    \node[state, right=of 1](2){};
    \node[state, above right=of 2](3){};
    \node[state, right=of 3](4){};
    \node[state,right=of 4](5){};
    \node[state,right=of 5](6){};
    \node[state,right=of 6](7){};
    \node[state,right=of 7](8){};
    \node[state,accepting,right=of 8](9){};
    \node[state, below right =of 2](10){};
    \node[state, right =of 10](11){};
    \node[state, accepting, right=of 11](12){};
    \draw (9) to[out=-135,in=5,looseness=0.6] (2);
    \draw (12) to[out=135,in=-5,looseness=0.6] (2);
\end{tikzpicture}
\end{figure}
\end{document}

введите описание изображения здесь

Связанный контент