目标如下:
这是我目前的情况。我知道如何制作弯曲的箭,但不知道弯曲的箭那远或那...具体来说,我猜?
\tikzstyle{allocated} = [>=latex, thick, <-, shorten <=2pt, shorten >=2pt]
\tikzstyle{requested} = [>=latex, thick, ->, shorten >=2pt, shorten <=2pt, dashed]
\tikzstyle{process} = [circle, fill=gray!30]
\tikzstyle{resource} = [fill=cyan!30,
minimum width=1cm,
minimum height=0.7cm]
\begin{tikzpicture}
\node[draw, resource] at (0, 0) (r1) {};
\node[anchor=south] at (r1.north) {$R_1$};
\node[draw, resource] at (4, 0) (r2) {};
\node[anchor=south] at (r2.north) {$R_2$};
\node[draw, process] at (0, -2) (t1) {$T_1$};
\node[draw, process] at (2, -2) (t2) {$T_2$};
\node[draw, process] at (4, -2) (t3) {$T_3$};
\path[allocated]
(t2) edge (r1)
(t2) edge (r2)
(t3) edge (r2);
\path[requested]
(t1) edge (r1);
\end{tikzpicture}
(您可能会注意到,这里有两种箭头,虚线和实线,在图中看不到。那是因为我试图使差异更加直观,因为我觉得这很令人困惑。)
答案1
你可以试试controls
,嗯
\tikzstyle{allocated} = [>=latex, thick, <-, shorten <=2pt, shorten >=2pt]
\tikzstyle{requested} = [>=latex, thick, ->, shorten >=2pt, shorten <=2pt, dashed]
\tikzstyle{process} = [circle, fill=gray!30]
\tikzstyle{resource} = [fill=cyan!30,
minimum width=1cm,
minimum height=0.7cm]
\begin{tikzpicture}
\node[draw, resource] at (0, 0) (r1) {};
\node[anchor=south] at (r1.north) {$R_1$};
\node[draw, resource] at (4, 0) (r2) {};
\node[anchor=south] at (r2.north) {$R_2$};
\node[draw, process] at (0, -2) (t1) {$T_1$};
\node[draw, process] at (2, -2) (t2) {$T_2$};
\node[draw, process] at (4, -2) (t3) {$T_3$};
\path[allocated]
(t2) edge (r1)
(t2) edge (r2)
(t3) edge (r2);
\path[requested]
(t1) edge (r1);
\draw[allocated] (t3) ..controls(5.5,1.5).. (r1);
\draw[allocated] (r2) ..controls(2,-3.5).. (t1);
\end{tikzpicture}
这是一个解决方案,但可能不是最好的。