答案1
该automata
库可让您非常轻松地绘制此类内容。我所做的只是对 pgfmanual 第 563 页的示例进行微小更改,然后Skillmon 的建议;-)。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath}
\usetikzlibrary{positioning,automata}
\begin{document}
\begin{tikzpicture}[shorten >=1pt,node distance=2.5cm,auto]
\node[state,initial] (1) {$1$};
\node[state] (2) [right=of 1] {$2$};
\node[state,accepting] (3) [right=of 2] {$3$};
\draw (1) edge [loop above] node {$\begin{bmatrix}\#\\ 0\\ 0\\{} *\end{bmatrix}$} (1)
(1) edge[->] node[above]{$\begin{bmatrix}\#\\ 0\\ 1\\{} *\end{bmatrix}$} (2)
(2) edge[->] node[above]{$\begin{bmatrix}\#\\ 1\\ 0\\{} *\end{bmatrix}$} (3)
(3) edge [loop above] node {$\begin{bmatrix}\#\\ 0\\ 0\\{} *\end{bmatrix}$} (3);
\end{tikzpicture}
\end{document}
当然你可以调整它。(编辑:增加double distance
。)
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath}
\usetikzlibrary{positioning,automata}
\begin{document}
\begin{tikzpicture}[shorten >=1pt,node distance=2.5cm,auto,initial text=,
loop above/.style={min distance=10mm,in=60,out=120,looseness=5}]
\node[state,initial] (1) {$1$};
\node[state] (2) [right=of 1] {$2$};
\node[state,accepting,double distance=2pt] (3) [right=of 2] {$3$};
\begin{scope}[font=\small]
\draw[->] (1) edge [loop above] node {$\begin{bmatrix}\#\\ 0\\ 0\\{} *\end{bmatrix}$} (1)
(1) edge node[above]{$\begin{bmatrix}\#\\ 0\\ 1\\{} *\end{bmatrix}$} (2)
(2) edge node[above]{$\begin{bmatrix}\#\\ 1\\ 0\\{} *\end{bmatrix}$} (3)
(3) edge [loop above] node {$\begin{bmatrix}\#\\ 0\\ 0\\{} *\end{bmatrix}$} (3);
\end{scope}
\end{tikzpicture}
\end{document}