这是十五个节点的网络。我不知道如何使用 latex 绘制。我尝试了以下五个节点的代码。
\begin{tikzpicture}
\graph[counterclockwise=6,
nodes, nodes={circle,draw, minimum size=0.01cm}] {
1, 2, 4, 3, 5
};
\draw[->] (1) edge[black, thick] (2);
\draw[->] (1) edge[black, thick] (3);
\draw[->] (2) edge[black, thick] (4);
\draw[->] (4) edge[black, thick] (2);
\draw[->] (3) edge[black, thick] (4);
\draw[->] (3) edge[black, thick] (5);
\draw[->] (5) edge[black, thick] (3);
\end{tikzpicture}
答案1
幸运的是,我使用“scope”完成了代码。见下文
\begin{tikzpicture}
\begin{scope}
\graph[counterclockwise=5,
nodes, nodes={circle,draw, minimum size=0.01cm}] {
1[fill = pink], 2, 4, 5, 3
};
\draw[->] (1) edge[black, thick] (2);
\draw[->] (1) edge[black, thick] (3);
\draw[->] (2) edge[black, thick] (4);
\draw[->] (4) edge[black, thick] (2);
\draw[->] (3) edge[black, thick] (4);
\draw[->] (3) edge[black, thick] (5);
\draw[->] (5) edge[black, thick] (3);
\end{scope}
\begin{scope}[shift={(3,0)}]
\graph[counterclockwise=5,
nodes, nodes={circle,draw, minimum size=0.01cm}] {
6, 7, 9, 10, 8
};
\draw[->] (6) edge[black, thick] (7);
\draw[->] (6) edge[black, thick] (8);
\draw[->] (9) edge[black, thick] (7);
\draw[->] (8) edge[black, thick] (9);
\draw[->] (9) edge[black, thick] (10);
\draw[->] (10) edge[black, thick] (8);
\draw[->] (8) edge[black, thick] (6);
\end{scope}
\begin{scope}[shift={(1.5,-3)}]
\graph[counterclockwise=5,
nodes, nodes={circle,draw, minimum size=0.01cm}] {
11, 12, 14, 15, 13
};
\draw[->] (11) edge[black, thick] (13);
\draw[->] (12) edge[black, thick] (11);
\draw[->] (14) edge[black, thick] (12);
\draw[->] (11) edge[black, thick] (14);
\draw[->] (14) edge[black, thick] (15);
\draw[->] (15) edge[black, thick] (13);
\end{scope}
\draw[-latex] (1) -- (6);
\draw[-latex] (9) -- (11);
\end{tikzpicture}
答案2
我在上面的代码片段前面添加了此代码:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
下面是:
\end{document}
结果如下:
为方便其他人查看,这里是完整列表:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\graph[counterclockwise=5,
nodes, nodes={circle,draw, minimum size=0.01cm}] {
1[fill = pink], 2, 4, 5, 3
};
\draw[->] (1) edge[black, thick] (2);
\draw[->] (1) edge[black, thick] (3);
\draw[->] (2) edge[black, thick] (4);
\draw[->] (4) edge[black, thick] (2);
\draw[->] (3) edge[black, thick] (4);
\draw[->] (3) edge[black, thick] (5);
\draw[->] (5) edge[black, thick] (3);
\end{scope}
\begin{scope}[shift={(3,0)}]
\graph[counterclockwise=5,
nodes, nodes={circle,draw, minimum size=0.01cm}] {
6, 7, 9, 10, 8
};
\draw[->] (6) edge[black, thick] (7);
\draw[->] (6) edge[black, thick] (8);
\draw[->] (9) edge[black, thick] (7);
\draw[->] (8) edge[black, thick] (9);
\draw[->] (9) edge[black, thick] (10);
\draw[->] (10) edge[black, thick] (8);
\draw[->] (8) edge[black, thick] (6);
\end{scope}
\begin{scope}[shift={(1.5,-3)}]
\graph[counterclockwise=5,
nodes, nodes={circle,draw, minimum size=0.01cm}] {
11, 12, 14, 15, 13
};
\draw[->] (11) edge[black, thick] (13);
\draw[->] (12) edge[black, thick] (11);
\draw[->] (14) edge[black, thick] (12);
\draw[->] (11) edge[black, thick] (14);
\draw[->] (14) edge[black, thick] (15);
\draw[->] (15) edge[black, thick] (13);
\end{scope}
\draw[-latex] (1) -- (6);
\draw[-latex] (9) -- (11);
\end{tikzpicture}
\end{document}