答案1
以下是我的绘制方法。蓝色节点与线条相连,因此移动节点也会移动所有线条。可以通过更改 的部分来更改箭头和节点的样式\tikzset{<name>/.style={<style>}}
。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\tikzset{node basic/.style={draw, ultra thick, blue, fill=blue!50, text=white, minimum size=2em}}
\tikzset{node circle/.style={node basic, circle}}
\tikzset{line basic/.style={very thick, ->}}
\tikzset{red dash/.style={line basic, dash dot, red}}
\tikzset{green dash/.style={line basic, dash dot, green}}
\tikzset{black dash/.style={line basic, dash dot}}
\tikzset{green line/.style={dash dot, green, ->}}
% Nodes
\node[node basic] (Q1) at (0, 0) {\(Q_1\)};
\node[node basic] (Q2) at (2, 0) {\(Q_2\)};
\node[node circle] (B1) at (-2, -3) {\(B_1\)};
\node[node circle] (B2) at (1, -3) {\(B_2\)};
\node[node circle] (B3) at (4, -3) {\(B_3\)};
% Red arrows
\draw[red dash] (B1.north) -- (Q1.south west) node[midway, left] {\scriptsize\(\alpha_1B_1\)};
\draw[red dash] (B2.north) -- (Q1.south) node[pos=0.7, left] {\scriptsize\(\alpha_2B_2\)};
\draw[red dash] (B3.north) -- (Q1.south east) node[midway, below] {\scriptsize\(\alpha_3B_3\)};
% Green Arrows
\draw[green dash] (B1.north) -- (Q2.south west) node[midway, below] {\scriptsize\(\gamma_1B_1\)};
\draw[green dash] (B2.north) -- (Q2.south) node[pos=0.2, right] {\scriptsize\(\gamma_2B_2\)};
\draw[green dash] (B3.north) -- (Q2.south east) node[midway, above right] {\scriptsize\(\gamma_2B_2\)};
% Black arrows
% Between Q
\draw[line basic] (Q1.west) -- ($(Q1.west) - (1, 0)$) node[left] {\(\delta(B_2 + B_3)\)};
\draw[line basic] ($(Q2.east)!0.5!(Q2.north east)$) -- ($(Q2.east)!0.5!(Q2.north east) + (1, 0)$) node[right] {\(\varepsilon Q_2\)};
\draw[line basic] ($(Q2.east)!0.5!(Q2.south east)$) -- ($(Q2.east)!0.5!(Q2.south east) + (1, 0)$) node[right] {\(\psi(B_2 + B_3)\)};
% Between B
\draw[line basic] (Q1.east) -- (Q2.west) node[midway, above] {\(\eta Q_1\)};
\draw[line basic] (B1.east) -- (B2.west) node[midway, below] {\(p_1B_1\)};
\draw[line basic] (B2.east) -- (B3.west) node[midway, below] {\(p_2B_2\)};
% Into/out of B
\draw[line basic] ($(B1.south west) - (0.5, 0.5)$) -- (B1.south west) node[pos=0, below] {\(\tau_1\Lambda\)};
\draw[line basic] ($(B2.south west) - (0.5, 0.5)$) -- (B2.south west) node[pos=0, below] {\(\tau_2\Lambda\)};
\draw[line basic] ($(B3.south west) - (0.5, 0.5)$) -- (B3.south west) node[pos=0, below] {\(\tau_3\Lambda\)};
\draw[line basic, <-] ($(B1.south east) - (-0.5, 0.5)$) -- (B1.south east) node[pos=0, below] {\(\mu_1B_1\)};
\draw[line basic, <-] ($(B2.south east) - (-0.5, 0.5)$) -- (B2.south east) node[pos=0, below] {\(\mu_2B_2\)};
\draw[line basic, <-] ($(B3.south east) - (-0.5, 0.5)$) -- (B3.south east) node[pos=0, below] {\(\mu_3B_3\)};
% f(N)B_2
\draw[line basic, dash dot] (B2.north west) .. controls ($(B2.west)!0.5!(B1.east) + (0, 0.5)$) .. (B1.north east) node[midway, above] {\footnotesize\(f(N)B_2\)};
\end{tikzpicture}
\end{document}
答案2
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{positioning,calc, arrows.meta}
\usetikzlibrary {shapes,matrix}
\usetikzlibrary {graphs, quotes}
\begin{document}
\begin{tikzpicture}[
terminal/.style={
circle,
minimum size=1.5cm,
very thick,
draw=blue,
anchor=center,
},
terminall/.style={
% circle,
minimum size=1.5cm,
very thick,
draw=blue,
anchor=center,
},
ass/.style={
->,>=stealth,line width=2pt, black
},
ass1/.style={
->,>=stealth,line width=2pt, green!50!black,dash pattern={on 7pt off 2pt on 1pt off 3pt},
},
ass2/.style={
->,>=stealth,line width=2pt, red!50!black,dash pattern={on 7pt off 2pt on 1pt off 3pt},
},
bigass/.style={
ass,out=155,in=15,looseness=1.1,dash pattern={on 7pt off 2pt on 1pt off 3pt}
},
]
\matrix[row sep=3cm,column sep=2cm] {%
%
% First row:
&
&
\node [terminall](q1) {Q\textsubscript{1}}; &
&
\node [terminall](q2) {Q\textsubscript{2}};
& \\
% Second row:
&
\node [terminal](b1) {B\textsubscript{1}}; & &
\node [terminal](b2) {B\textsubscript{2}};&&
\node [terminal](b3) {B\textsubscript{3}};&
\\
%
};
\draw (b1) edge[ass] (b2);
\draw (b2) edge[ass] (b3);
\draw (q1) edge[ass] (q2);
\draw ($(q2.east)+(0pt,6pt)$)coordinate(aux) edge[ass]($(aux)+(3cm,0)$);
\draw ($(q2.east)+(0pt,-6pt)$)coordinate(aux1) edge[ass]($(aux1)+(3cm,0)$);
\draw ($(q1.west)+(0pt,3pt)$)coordinate(aux2) edge[ass]($(aux2)+(-3cm,0)$);
\draw (b1) edge[ass2] (q1);
\draw (b2) edge[ass2] (q1);
\draw (b3) edge[ass2] (q1);
\draw (b1) edge[ass1] (q2);
\draw (b2) edge[ass1] (q2);
\draw (b3) edge[ass1] (q2);
\draw (b2) edge[bigass] (b1);
\draw (b2.315) edge[ass]++(315:1cm);
\draw (b1.315) edge[ass]++(315:1cm);
\draw (b3.315) edge[ass]++(315:1cm);
\draw ($(b2.215)+(215:1cm)$)edge[ass](b2.215);
\draw ($(b1.215)+(215:1cm)$)edge[ass](b1.215);
\draw ($(b3.215)+(215:1cm)$)edge[ass](b3.215);
\end{tikzpicture}
\end{document}