答案1
这或多或少取自 pgfmanual v3.1.4 第 43.3 节上方的示例。当然,我重新安排了一些内容,更改了文本,但结果是许多事情已经完成,人们可以通过复制和修改它们来获得一些期望的结果。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{automata,positioning}
\begin{document}
\begin{tikzpicture}[shorten >=1pt,shorten <=1pt,>=stealth,
node distance=2cm,on grid]
\begin{scope}[nodes={state}]
\node (x_1) {$x_1$};
\node (x_2) [left=of x_1] {$x_2$};
\node (x_3) [right=of x_1] {$x_3$};
\node (x_4) [above=of x_1] {$x_4$};
\end{scope}
\path[->,blue,thick] foreach \X in {2,3,4} {(x_1) edge (x_\X)}
foreach \X in {2,3} {(x_\X) edge (x_4)}
(x_4) edge[loop right] ();
\end{tikzpicture}
\end{document}
当然你可以把这个放在问题的图形环境中。
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}
\begin{document}
\begin{figure}[!htp]
\centering
\begin{tikzpicture}[shorten >=1pt,shorten <=1pt,>=stealth,
node distance=2cm,on grid]
\begin{scope}[nodes={state}]
\node (x_1) {$x_1$};
\node (x_2) [left=of x_1] {$x_2$};
\node (x_3) [right=of x_1] {$x_3$};
\node (x_4) [above=of x_1] {$x_4$};
\end{scope}
\path[->,blue,thick] foreach \X in {2,3,4} {(x_1) edge (x_\X)}
foreach \X in {2,3} {(x_\X) edge (x_4)};
\draw[->,blue,thick] (x_4) to[out=-20,in=20,looseness=12] (x_4);
\end{tikzpicture}
\caption{A digraph $G$ of order 4.}
\end{figure}
\end{document}