[Tex/LaTex] Network diagram with flow on Latex

diagramsflow charts

I would like to be able to draw a nice diagram in one of my paper, however, I am having some trouble finding either a tutorial that explains to me how to do a diagram along the lines of the one I have in mind. The figure 1 in this paper is more or less what I am looking for https://arxiv.org/pdf/1707.05398.pdf. Does anyone have an idea on how to implement such a diagram in latex? I have checked on http://www.texample.net/tikz/ but couldn't find anything relevant sadly.

enter image description here

Best Answer

\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[font=\sf]
\node[draw,circle,label=below:$n_1$] (n1) at ({-sqrt(3)},-1){};
\node[draw,circle,label=above:$n_2$] (n2) at (0,2){};
\node[draw,circle,label=below:$n_3$] (n3) at ({sqrt(3)},-1){};
\node[draw,circle,label=above:$s_2$,label=below:$d_1$] (s2) at (-4,3){};
\node[draw,circle,label=above:$s_3$] (s3) at (4,3){};
\node[draw,circle,label=above:$s_1$] (s1) at (-4,-2){};
\node[draw,circle,label=above:$d_3$,label=below:$d_2$] (s4) at (4,-2){};
\draw[thick,-latex] (n1) -- (n2);
\draw[thick,-latex] (n1) -- (n3);
\draw[thick,-latex] (n2.-45) -- (n3.105);
\draw[thick,-latex] (n3.135) -- (n2.-75);
\draw[thick,-latex] (s1) -- (n1);
\draw[thick,-latex] (n3) -- (s4);
\draw[thick,-latex] (s3) -- (n2);
\draw[thick,-latex] (s2.-15) -- (n2.135);
\draw[thick,-latex] (n2.165) -- (s2.-45);
\draw[green,dashed,thick,-latex] (-4.2,3.2) .. controls ($(n2)+(0.5cm,1cm)$) and
($(n3)-(1cm,2cm)$) .. (4.2,-2.2);
\node at (-3,3.5) {Flow 2}; 
\draw[blue,dashed,thick,-latex] (4.2,3.2) .. controls ($(n2)+(0.5cm,-0.5cm)$) and
($(n3)-(0cm,0cm)$) .. (4.2,-2);
\node at (-3,1) {Flow 1}; 
\draw[red,dashed,thick,-latex] (-4.2,-2.2) .. controls ($(n1)-(0.15cm,0cm)$) and
($(n2)-(0.2cm,0cm)$) .. (-4.2,3.2);
\node at (3,1) {Flow 3}; 
\end{tikzpicture}
\end{document}

enter image description here

Related Question