我正在尝试使用 tkiz 在 latex 中重新创建此铁路图,但箭头却让我很头疼。我认为用箭头添加标签应该相当容易,但具有挑战性的部分是箭头。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs,positioning,arrows}
\begin{document}
\begin{tikzpicture}[%
node distance=5mm,
>=stealth',
black!50,
text=black,
graphs/every graph/.style={edges=rounded corners},
skip loop/.style={to path={-- ++(0,#1) -| (\tikztotarget)}},
hv path/.style={to path={-| (\tikztotarget)}},
vh path/.style={to path={|- (\tikztotarget)}},
box/.style={%
rectangle,
minimum size=6mm,
draw=black,
top color=white,
bottom color=red!50!black!20,
},
rounded/.style={%
rectangle,minimum size=6mm,rounded corners=3mm,
draw=black!50,
top color=white,bottom color=black!20,
},
start/.style={%
circle,inner sep=2pt,minimum size=2pt,fill=white,draw=black!50,
},
end/.style={%
start,
},
]
\node[start] (start) {};
\node[right=of start] (scc-scheduling-pre) {};
\node[box,right=of scc-scheduling-pre] (scc-scheduling) {SCC Scheduling};
\node[box,below=of scc-scheduling] (chunk-scheduling) {Chunk Scheduling};
\node[box,below=of chunk-scheduling] (group-scheduling) {Group Scheduling};
\node[end,right=of group-scheduling] (end) {};
\graph [use existing nodes] {
(start)->(scc-scheduling-pre);
(scc-scheduling)->(chunk-scheduling);
(chunk-scheduling)->(group-scheduling);
(group-scheduling)->(end);
};
\end{tikzpicture}
\end{document}
我迄今为止的尝试:
答案1
像这样?
使用ext.paths.ortho
Ti钾Z 库和链中的节点:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
calc, chains,
ext.paths.ortho, % for -|- path operations
positioning}
\begin{document}
\begin{tikzpicture}[%
node distance = 8mm and 12mm,
start chain = A going below,
arr/.style = {-Stealth, shorten >=1mm, shorten <=1mm},
box/.style = {draw, semithick, align=center,
minimum height=6mm, text width=9em},
C/.style = {circle, draw=black!50, semithick, node contents={}},
every join/.style = {arr}
]
\begin{scope}[nodes={on chain=A}]
\coordinate (aux);
\node[box] {SCC Scheduling}; % A-2
\node[box, join] {Chunk Scheduling};
\node[box, join] {Group Scheduling}; % A-4
\end{scope}
\node (in) [C, left =of A-2,
label=left: Start];
\node (out) [C, right=of A-4,
label=right:End];
%%%%
\draw[arr] (in) -- (A-2);
\draw[arr] (A-4) -- (out);
\draw[arr] (A-3.east) -|-[distance=-6em] (aux)
node[pos=0.5, right, align=left] {Loop SC\\ for each Chunk}
-| ($(in)!0.5!(A-2.west)$);
\draw[arr] (A-4.west) -|-[distance=-6em] ($(A-2.south)!0.5!(A-3.north)$)
node[pos=0.5, left, align=right] {Loop Chunk\\ for each Group};
\end{tikzpicture}
\end{document}