我想要绘制这个自动机:
但我画得很糟糕!!
\documentclass{article}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usepackage[latin1]{inputenc}
\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,semithick]
\node[initial,state] (A) {$1$};
\node[state] (B) [right of=A] {$2$};
\node[state] (C) [right of=B] {$3$};
\node[state] (D) [right of=C] {$4$};
\node[state,accepting] (E) [right of=D] {$5$};
\node[state,accepting] (F) [below of=E] {$6$};
\node[state,accepting] (G) [below of=D] {$7$};
\node[state,accepting] (H) [below of=G] {$8$};
\node[state,accepting] (I) [below of=H] {$9$};
\node[state] (J) [below of=A] {$10$};
\node[state,accepting] (P) [below of=J] {$16$};
\node[state] (K) [below left of=I] {$11$};
\node[state] (L) [right of=K] {$12$};
\node[state,accepting] (M) [right of=L] {$13$};
\node[state,accepting] (N) [below of=L] {$14$};
\node[state,accepting] (O) [below of=M] {$15$};
\node[state,accepting] (Q) [below of=B] {$17$};
\path (A) edge node {X}(B)
edge node{I} (C)
edge node{V} (J)
(B) edge [loop above] node {X}(B)
edge node{I} (C)
edge node{V} (J)
edge node{<>I,<>V} (Q)
(C) edge node {X}(H)
edge node{I} (D)
edge node{V} (G)
edge node{Autre} (I)
(D) edge node {I}(E)
edge node{<>I} (F)
(J) edge node {I}(K)
edge node{<>I} (P)
(K) edge node {I}(L)
edge node{<>I} (N)
(L) edge node {I}(M)
edge node{<>I} (O);
\end{tikzpicture}
\end{document}
答案1
您可以在 s后面添加bend left
或bend right
或bend left=<degree>
或。以下是示例:bend right=<degree>
edge
\usetikzlibrary{positioning,automata}
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid]
\node[state,initial] (q_0) {$q_0$};
\node[state] (q_1) [right=of q_0] {$q_1$};
\node[state,accepting] (q_2) [right=of q_1] {$q_2$};
\path[->] (q_0) edge node [above] {0} (q_1)
edge [loop above] node {1} ()
edge [bend left=45] node [below] {1} (q_2)
edge [bend right] node [below] {0} (q_2)
(q_1) edge node [above] {1} (q_2);
\end{tikzpicture}
结果:
答案2
很晚了,但这是你的答案;)
\begin{tikzpicture}[shorten >=1pt,auto,node distance=2.8cm,semithick]
\node[state,initial] (A) {$1$};
\node[state] (B) [right of=A] {$2$};
\node[state] (C) [right of=B] {$3$};
\node[state] (D) [right of=C] {$4$};
\node[state,accepting] (E) [right of=D] {$5$};
\node[state,accepting] (F) [below of=E] {$6$};
\node[state,accepting] (G) [below of=D] {$7$};
\node[state,accepting] (H) [below of=G] {$8$};
\node[state,accepting] (I) [below of=H] {$9$};
\node[state] (J) [below of=A] {$10$};
\node[state,accepting] (P) [below of=J] {$16$};
\node[state] (K) [below left of=I] {$11$};
\node[state] (L) [right of=K] {$12$};
\node[state,accepting] (M) [right of=L] {$13$};
\node[state,accepting] (N) [below of=L] {$14$};
\node[state,accepting] (O) [below of=M] {$15$};
\node[state,accepting] (Q) [below of=B] {$17$};
\path[->]
(A) edge [bend left=45] node {$X$}(B)
edge [bend left=80] node{$I$} (C)
edge node{$V$} (J)
(B) edge [loop above] node {$X$}(B)
edge [bend left=45] node {$I$} (C)
edge node {$V$} (J)
edge node {$<>I,<>V$} (Q)
(C) edge [bend left=-5] node {$X$} (H)
edge [bend left=45] node {$I$} (D)
edge [bend left=15] node {$V$} (G)
edge [bend left=-25] node {Autre} (I)
(D) edge [bend left=45] node {$I$}(E)
edge node {$<>I$} (F)
(J) edge [bend left=15] node {$I$}(K)
edge node {$<>I$} (P)
(K) edge [bend left=45] node {$I$}(L)
edge node {$<>I$} (N)
(L) edge [bend left=45] node {$I$}(M)
edge node{$<>I$} (O);
\end{tikzpicture}