答案1
这是使用 Tikz 创建的图表,必须使用circular
和routing
库进行编译Lualatex
。
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary {graphs,graphdrawing}
\usegdlibrary {circular,routing}
\usetikzlibrary{arrows.meta,bending}
\begin{document}
\begin{tikzpicture}[>={Stealth[round,sep]}]
\graph [simple necklace layout, node distance=1.5cm,
necklace routing,
grow'=north,
math nodes,
edges={>={Stealth[round,sep,bend]}}]
{ x_1 -> x_2 -> x_3 -> x_4 -> x_5 -> x_6 -> x_1};
\graph [use existing nodes,
math nodes,
edges={bend right=15,>={Stealth[round,sep,bend]}}]{
x_1 -> x_3 -> x_5 -> x_1,x_2 -> x_4 -> x_6 -> x_2
};
\end{tikzpicture}
\end{document}
答案2
这是玩具版元帖子。没有特殊的图形语言,只有普通的 MP 和一个自己动手的连接函数。我把可疑的箭头涂上了颜色,以防 OP 真的想把它省略掉。(要完全隐藏它,你可以用 来绘制它white
)。
这是源代码。用 进行编译lualatex
。
\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path C;
C = fullcircle scaled 89;
vardef connection(expr a, b, deflection) =
a {b-a rotated deflection} .. b
cutbefore fullcircle scaled 18 shifted a
cutafter fullcircle scaled 18.4 shifted b
enddef;
interim ahangle := 30;
numeric N, r, s;
N = 6; % number of points
r = -8 / N; % unit rotation
s = 6 - r; % starting point on the circle
for i=1 upto N:
label("$x_{" & decimal i & "}$", point s + i * r of C);
drawarrow connection(point s + i * r of C, point s + i * r + r of C, +36);
drawarrow connection(point s + i * r of C, point s + i * r + 2r of C, -18)
withcolor if i=3: 1/2 [blue, white] else: black fi;
endfor
endfig;
\end{mplibcode}
\end{document}
请注意,MP 的圆形路径上的时间概念在这里非常有用;我依赖于这样一个事实:在圆形上,与、 等point 8
相同。我忍不住要稍微笼统一点,所以如果你把它改成有,你会得到:point 0
point 9 = point 1
N=7
如果你想要奇特的线条交叉,你可以将其更改connection()
为类似以下内容:
vardef connection(expr a, b, deflection) =
path p; p =
a {b-a rotated deflection} .. b
cutbefore fullcircle scaled 18 shifted a
cutafter fullcircle scaled 18.4 shifted b;
undraw p withpen pencircle scaled 2; p
enddef;
得到这个:
答案3
带有 Tikz 的版本。
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\def\NumNodes{6}
\begin{tikzpicture}
\foreach \x [evaluate=\x as \ang using (\x-1)*360/\NumNodes+90] in {1,...,\NumNodes}{
\node[circle,inner sep=1pt](A\x) at (\ang:2){$x_{\x}$};
\draw[-latex] (\ang-10:2) arc (\ang-10:{\ang-360/\NumNodes+10}:2);
}
\foreach \x [evaluate=\x as \xx using {int(Mod(\x-3,\NumNodes)+1)}]in {1,...,\NumNodes}{
\draw[-latex] (A\x) to[bend right=20] (A\xx);
}
\end{tikzpicture}
\end{document}