在这个有向图中,我想让向下的“b”边“塞在”向上的“b”边后面。
类似的做法是,在“b”边相交处创建一个顶点,并将其填充为白色,但将其放在向上的“b”边后面。外观基本上是在向下的“b”边即将与另一个“b”边相交的地方出现一个小裂口。
有没有简单的方法可以实现这一点?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\begin{scope}[every node/.style={fill=black,circle,thin,draw}]
\node (a1) at (2,2) {};
\node (a2) at (4,2) {};
\node (a3) at (6,2) {};
\node (a4) at (8,2) {};
\node (a5) at (10,2) {};
\node (a6) at (12,2) {};
\node (b1) at (2,8) {};
\node (b2) at (4,8) {};
\node (b3) at (6,8) {};
\node (b4) at (8,8) {};
\node (b5) at (10,8) {};
\node (b6) at (12,8) {};
\end{scope}]
\begin{scope}[every node/.style={draw=none}]
\node (a0) at (0,2) {};
\node (b0) at (0,8) {};
\node (a7) at (14,2) {};
\node (b7) at (14,8) {};
\end{scope}
\begin{scope}[>={Stealth[black]},
every node/.style={fill=white,circle},
every edge/.style={draw=black}]
\path [->] (a1) edge node {$a$} (a2);
\path [->] (a2) edge (a3);
\path [->] (a3) edge (a4);
\path [->] (a4) edge (a5);
\path [->] (a5) edge (a6);
\path [->] (b1) edge node {$a$} (b2);
\path [->] (b2) edge (b3);
\path [->] (b3) edge (b4);
\path [->] (b4) edge (b5);
\path [->] (b5) edge (b6);
\path [->>] (a1) edge node {$b$} (b2);
\path [->>] (a2) edge (b3);
\path [->>] (a3) edge (b4);
\path [->>] (a4) edge (b5);
\path [->>] (a5) edge (b6);
\path [->>] (b1) edge (a3);
\path [->>] (b2) edge (a4);
\path [->>] (b3) edge (a5);
\path [->>] (b4) edge node {$b$} (a6);
\end{scope}
\begin{scope}[>={Stealth[black]},
every edge/.style={draw=black}]
\path (a0) edge [dashed] node {} (a1);
\path (b0) edge [dashed] node {} (b1);
\path (a6) edge [dashed] node {} (a7);
\path (b6) edge [dashed] node {} (b7);
\path (a0) edge [dashed] node {} (b1);
\path (a6) edge [dashed] node {} (b7);
\path (b0) edge [dashed] node {} (a2);
\path (b5) edge [dashed] node {} (a7);
\end{scope}
\end{tikzpicture}
\end{document}
答案1
tikz-cd
这可以通过使用来完成crossing over
。
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[cells={nodes={fill, circle, inner sep=.7mm}}, row sep=3cm, >={stealth}]
|[fill=none]|\arrow[r,dashed,-] \arrow[drr,dashed,-]
& ||\arrow[r,->, "a" description] \arrow[drr,->>]
& ||\arrow[r,->] \arrow[drr,->>]
& ||\arrow[r,->] \arrow[drr,->>]
& ||\arrow[r,->] \arrow[drr,->>,"b" description]
& ||\arrow[r,->] \arrow[drr,dashed,-]
& ||\arrow[r,dashed,-]
& |[fill=none]|\\
|[fill=none]|\arrow[r,dashed,-] \arrow[ur,dashed,-,crossing over]
& ||\arrow[r,->, "a" description] \arrow[ur,->>,crossing over,"b" description]
& ||\arrow[r,->] \arrow[ur,->>,crossing over]
& ||\arrow[r,->] \arrow[ur,->>,crossing over]
& ||\arrow[r,->] \arrow[ur,->>,crossing over]
& ||\arrow[r,->] \arrow[ur,->>,crossing over]
& ||\arrow[r,dashed,-] \arrow[ur,dashed,-,crossing over]
& |[fill=none]|
\end{tikzcd}
\end{document}
答案2
我提出这个pstricks
解决方案:
\documentclass[pstricks, border=6pt]{standalone}AS
\usepackage{pst-node, multido}
\begin{document}
\begin{pspicture}(0,1)(14,8.5)
\psset{linejoin=1, arrowinset=0.1, dotscale=2}
\multido{\i=1+1, \I=2+2}{6}{\dotnode(\I,2){a\i}\dotnode(\I, 8){b\i}}
\pnodes(0,2){a0}(0,8){b0}(14,2){a7}(14,8){b7}
\psset{arrows=->}
\ncline{a1}{a2}\ncput*{$a$}
\ncline{b1}{b2}\ncput*{$a$}
\ncline[linewidth=0pt]{a1}{b2}\ncput*{$b$}
\multido{\i=2+1,\I=3+1}{4}{\ncline{a\i}{a\I}\ncline{b\i}{b\I}}%
\foreach \s/\t in {b1/a3, b2/a4, b3/a5, b4/a6}{\ncline{->>}{\s}{\t}} \ncput*{$b$}
\foreach \s/\t in {a2/b3, a3/b4, a4/b5, a5/b6, a1/b2}{\ncline[border=2pt]{->>}{\s}{\t}} \ncput*{$b$}
\psset{linestyle=dashed, arrows=-}
\psline(b1)(b0)(a2)\psline(a1)(a0)(b1)
\psline(b6)(b7)(a6)\psline(a6)(a7)(b5)
\end{pspicture}
\end{document}