![同じノードで始まり、終わる曲線矢印を取得する方法](https://rvso.com/image/391711/%E5%90%8C%E3%81%98%E3%83%8E%E3%83%BC%E3%83%89%E3%81%A7%E5%A7%8B%E3%81%BE%E3%82%8A%E3%80%81%E7%B5%82%E3%82%8F%E3%82%8B%E6%9B%B2%E7%B7%9A%E7%9F%A2%E5%8D%B0%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95.png)
こんにちは。下のグラフを再現しようとしています。ほとんどは完成しましたが、矢印の始点と終点を設定する方法がわかりません。
下の図はなんとかできました。ノード E の矢印の作成で行き詰まっています。
下記にコードを添付しました
\tikzstyle{state} = [circle, minimum width=2cm, draw=black]
\begin{tikzpicture}[very thick, ->, >=stealth,auto, node distance=4cm]
\node(shift) [state] {Shift $=1$};
\node [above of=shift, yshift=-3.5cm] {S};
\node(add) [state, right of=shift] {Add $=1$};
\node [above of=add, yshift=-3.5cm] {A};
\node(init) [state, right of=add] {Init $=1$};
\node [above of=init, yshift=-3.5cm] {I};
\node(control) [state, below of=add] {};
\node [above of=control, yshift=-3.5cm] {C};
\node(others) [state, below of=control] {};
\node [above of=others, yshift=-3.5cm] {Others};
\node(end) [state, right of=control] {Done $=1$};
\node [above of=end, yshift=-3.5cm] {E};
\node(reset) [circle, draw=black, fill=black, right of=end, xshift=-1.5cm] {};
\node [above of=reset, yshift=-3.5cm] {Reset};
\path (add) edge node [above] {$1$} (shift);
\path (shift) edge[bend right] node [below left] {LSB/Stop $=00$} (control);
\path (control) edge[] node [above right] {$1$} (shift);
\path (control) edge[] node [right] {LSB $=1$} (add);
\path (init) edge[] node [below right] {$1$} (control);
\path (end) edge[] node [right] {Start $=1$} (init);
\path (control) edge[] node [above] {$01$} (end);
\path (others) edge[] node [above left] {$1$} (end);
\path (reset) edge[] node [] {} (end);
\end{tikzpicture}
答え1
このような ?(説明についてはコメント行を参照)
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\tikzstyle{state} = [circle, minimum width=2cm, draw=black]
\begin{tikzpicture}[very thick, ->, >=stealth,auto, node distance=4cm]
\node(shift) [state] {Shift $=1$};
\node [above of=shift, yshift=-3.5cm] {S};
\node(add) [state, right of=shift] {Add $=1$};
\node [above of=add, yshift=-3.5cm] {A};
\node(init) [state, right of=add] {Init $=1$};
\node [above of=init, yshift=-3.5cm] {I};
\node(control) [state, below of=add] {};
\node [above of=control, yshift=-3.5cm] {C};
\node(others) [state, below of=control] {};
\node [above of=others, yshift=-3.5cm] {Others};
\node(end) [state, right of=control] {Done $=1$ };
\draw (end) to [in=-40,out=220,looseness=5,min distance=30mm]node[above]{Start $=0$} (end);% <------ loop Start=0
\node [above of=end, yshift=-3.5cm] {E };
\node(reset) [circle, draw=black, fill=black, right of=end, xshift=-1.5cm] {};
\node [above of=reset, yshift=-3.5cm] {Reset};
\path (add) edge node [above] {$1$} (shift);
\path (shift) edge[bend right] node [below left] {LSB/Stop $=00$} (control);
\path (control) edge[] node [above right] {$1$} (shift);
\path (control) edge[] node [right] {LSB $=1$} (add);
\path (init) edge[] node [below right] {$1$} (control);
\path (end) edge[] node [right] {Start $=1$} (init);
\path (control) edge[] node [above] {$01$} (end);
\path (others) edge[] node [above left] {$1$} (end.200);%<--- arrows a little above
\path (reset) edge[] node [] {} (end);
%\node [circle,draw] at (end){} edge [in=30,out=60,loop] ();
\end{tikzpicture}
\end{document}
補遺:
\tikzstyle
は非推奨です\tikzset
。代わりに以下を使用してください。
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
%\tikzstyle{state} = [circle, minimum width=2cm, draw=black]
\tikzset{state/.style={circle, minimum width=2cm, draw=black}}
\begin{tikzpicture}[very thick, ->, >=stealth,auto, node distance=4cm]
\node(shift) [state] {Shift $=1$};
\node [above of=shift, yshift=-3.5cm] {S};
\node(add) [state, right of=shift] {Add $=1$};
\node [above of=add, yshift=-3.5cm] {A};
\node(init) [state, right of=add] {Init $=1$};
\node [above of=init, yshift=-3.5cm] {I};
\node(control) [state, below of=add] {};
\node [above of=control, yshift=-3.5cm] {C};
\node(others) [state, below of=control] {};
\node [above of=others, yshift=-3.5cm] {Others};
\node(end) [state, right of=control] {Done $=1$ };
\draw (end) to [in=-40,out=220,looseness=5,min distance=30mm]node[above]{Start $=0$} (end);% <------ loop Start=0
\node [above of=end, yshift=-3.5cm] {E };
\node(reset) [circle, draw=black, fill=black, right of=end, xshift=-1.5cm] {};
\node [above of=reset, yshift=-3.5cm] {Reset};
\path (add) edge node [above] {$1$} (shift);
\path (shift) edge[bend right] node [below left] {LSB/Stop $=00$} (control);
\path (control) edge[] node [above right] {$1$} (shift);
\path (control) edge[] node [right] {LSB $=1$} (add);
\path (init) edge[] node [below right] {$1$} (control);
\path (end) edge[] node [right] {Start $=1$} (init);
\path (control) edge[] node [above] {$01$} (end);
\path (others) edge[] node [above left] {$1$} (end.200);%<--- arrows a little above
\path (reset) edge[] node [] {} (end);
\end{tikzpicture}
\end{document}