このマシンに矢印を追加するには助けが必要です

このマシンに矢印を追加するには助けが必要です

4から2、6から2、14から11、16から11の矢印が必要です。 ありがとうございます!

\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]
1.19 a
%\centering
\begin{tikzpicture}[node distance=2em and 2em]
    \node[state, initial](1) {};
    \node[state, right=of 1](2){};
    \node[state, above right=of 2](3){};
    \node[state, right=of 3](4) {};
    \node[state, below right=of 2](5){};
    \node[state, right=of 5](6){};
    \node[state, below right=of 4](7){};
    \node[state,right=of 7](8){};
    \node[state,right=of 8](9){};
    \node[state,right=of 9](10){};
    \node[state,accepting, below =of 10](11){};
    \node[state, below left=of 11](12){};
    \node[state, above left =of 12](13){};
    \node[state, below left=of 12](15){};
    \node[state,accepting,left =of 13](14){};
    \node[state,accepting, left =of 15](16){};
    \draw
    (1) edge[above] node{$\epsilon$} (2)
    (1) to[out=50,in=90,looseness=1.2, above]node{$\epsilon$} (7)
    (2) edge[above]node{$\epsilon$}(3)
    (2) edge[above]node{$\epsilon$}(5)
    (3) edge[below]node{$0$}(4)
    (5) edge[above]node{$1$}(6)
    (4) edge[below]node{$\epsilon$}(7)
    (6) edge[above]node{$\epsilon$}(7)
    (7) edge[above]node{$0$}(8)
    (8) edge[above]node{$0$}(9)
    (9) edge[above]node{$0$}(10)
    (10) edge[left]node{$\epsilon$}(11)
    (11) edge[above]node{$\epsilon$}(12)
    (12) edge[above]node{$\epsilon$}(13)
    (13) edge[above]node{$0$}(14)
    (12) edge[above]node{$\epsilon$}(15)
    (15) edge[above]node{$1$}(16);
\path (current bounding box.north) ++ (0,1cm);
\end{tikzpicture}
\caption{$(0\cup 1)^*000(0\cup 1)^*$}
\end{figure}
 \end{document}

答え1

bend leftbend right、を使用するinと、out衝突を回避するように矢印を曲げることができます。これらの曲がった曲線によって境界ボックスが大きくなりすぎる場合は、 を使用してoverlay境界ボックスの決定から除外することができます。

\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]
1.19 a
%\centering
\begin{tikzpicture}[node distance=2em and 2em]
    \node[state, initial](1) {};
    \node[state, right=of 1](2){};
    \node[state, above right=of 2](3){};
    \node[state, right=of 3](4) {};
    \node[state, below right=of 2](5){};
    \node[state, right=of 5](6){};
    \node[state, below right=of 4](7){};
    \node[state,right=of 7](8){};
    \node[state,right=of 8](9){};
    \node[state,right=of 9](10){};
    \node[state,accepting, below =of 10](11){};
    \node[state, below left=of 11](12){};
    \node[state, above left =of 12](13){};
    \node[state, below left=of 12](15){};
    \node[state,accepting,left =of 13](14){};
    \node[state,accepting, left =of 15](16){};
    \draw
    (1) edge[above] node{$\epsilon$} (2)
    (1) to[out=50,in=90,looseness=1.2, above]node{$\epsilon$} (7)
    (2) edge[above]node{$\epsilon$}(3)
    (2) edge[above]node{$\epsilon$}(5)
    (3) edge[below]node{$0$}(4)
    (5) edge[above]node{$1$}(6)
    (4) edge[below]node{$\epsilon$}(7)
    (6) edge[above]node{$\epsilon$}(7)
    (7) edge[above]node{$0$}(8)
    (8) edge[above]node{$0$}(9)
    (9) edge[above]node{$0$}(10)
    (10) edge[left]node{$\epsilon$}(11)
    (11) edge[above]node{$\epsilon$}(12)
    (12) edge[above]node{$\epsilon$}(13)
    (13) edge[above]node{$0$}(14)
    (12) edge[above]node{$\epsilon$}(15)
    (15) edge[above]node{$1$}(16)
    (4) edge[bend left=15] (2)
    (6) edge[bend right=15] (2)
    (14) edge[bend left=30] (11)
    (16) edge[out=-40,in=-90,overlay] (11)
    ;
\path (current bounding box.north) ++ (0,1cm);
\end{tikzpicture}
\caption{$(0\cup 1)^*000(0\cup 1)^*$}
\end{figure}
\end{document}

ここに画像の説明を入力してください

または、曲がった矢印と更新されたノードを使用します。今度は、looseness適切な場所も変更しました。

\documentclass{article}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows.meta,bending}
\tikzset{
->, % makes the edges directed
>={Stealth[bend]}, % 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]
1.19 a
%\centering
\begin{tikzpicture}[node distance=2em and 2em]
    \node[state, initial](1) {};
    \node[state, right=of 1](2){};
    \node[state, above right=of 2](3){};
    \node[state, right=of 3](4) {};
    \node[state, below right=of 2](5){};
    \node[state, right=of 5](6){};
    \node[state, below right=of 4](7){};
    \node[state,right=of 7](8){};
    \node[state,right=of 8](9){};
    \node[state,right=of 9](10){};
    \node[state,accepting, below =of 10](11){};
    \node[state, below left=of 11](12){};
    \node[state, above left =of 12](13){};
    \node[state, below left=of 12](15){};
    \node[state,accepting,left =of 13](14){};
    \node[state,accepting, left =of 15](16){};
    \draw
    (1) edge[above] node{$\epsilon$} (2)
    (1) to[out=50,in=90,looseness=1.2, above]node{$\epsilon$} (7)
    (2) edge[above]node{$\epsilon$}(3)
    (2) edge[above]node{$\epsilon$}(5)
    (3) edge[below]node{$0$}(4)
    (5) edge[above]node{$1$}(6)
    (4) edge[below]node{$\epsilon$}(7)
    (6) edge[above]node{$\epsilon$}(7)
    (7) edge[above]node{$0$}(8)
    (8) edge[above]node{$0$}(9)
    (9) edge[above]node{$0$}(10)
    (10) edge[left]node{$\epsilon$}(11)
    (11) edge[above]node{$\epsilon$}(12)
    (12) edge[above]node{$\epsilon$}(13)
    (13) edge[above]node{$0$}(14)
    (12) edge[above]node{$\epsilon$}(15)
    (15) edge[above]node{$1$}(16)
    (4) edge[bend left=15] (2)
    (6) edge[bend right=15] (2)
    (14) edge[out=45,in=90,looseness=1.5] (12)
    (16) edge[out=-45,in=-90,looseness=1.5,overlay] (12)
    ;
\path (current bounding box.north) ++ (0,1cm)
(current bounding box.south) ++ (0,-0.3cm);
\end{tikzpicture}
\caption{$(0\cup 1)^*000(0\cup 1)^*$}
\end{figure}
\end{document}

ここに画像の説明を入力してください

関連情報