1

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

egreg
  • 1,121,712
  • recently i saw here some good souls who offer service "i-will-do-it-for-you" , maybe someone will raw this image for you ... however, you should show us, what you do so far and where you stack in this. in normal circumstances here is not offer mentioned service. welcome to tex.se! – Zarko Feb 08 '18 at 14:05
  • As a general note, if you only look for tutorials/examples that are nearly identical to what you're after, there will in most cases be little or no info. So don't look just for that, look also for diagrams with similar concepts, e.g. circles with lines drawn between them. There is an example of exactly that in the second tutorial of the TikZ manual as well (chapter 3), which would probably be beneficial to go through. If you do that you should be able to do most of that diagram yourself I would think. Then ask about the parts that you are unable to figure out. – Torbjørn T. Feb 08 '18 at 14:08
  • Welcome to TeX.SX! My impression is that the image has been produced wit an external tool. – egreg Feb 08 '18 at 14:08
  • Yeah, of course, my point is mostly to get a tutorial. I think the main issue is how to draw the flow lines. The rest can be done using traditional tutorials. – Birdy Nam Nam Feb 08 '18 at 14:11
  • @TorbjørnT. Funnily enough, I was actually checking this exact chapter today :-). – Birdy Nam Nam Feb 08 '18 at 14:14
  • @egreg Interesting, do you have any idea what tool would have been used to construct such diagrams? – Birdy Nam Nam Feb 08 '18 at 14:23
  • If you download the source from arXiv, you discover that the picture is an external PDF file, which says to have Mac OS X 10.11.6 Quartz PDFContext as producer. No idea what tool was used. – egreg Feb 08 '18 at 14:39
  • One possible method for the flow lines could be https://tex.stackexchange.com/questions/33607/easy-curves-in-tikz/33610#33610 – Torbjørn T. Feb 08 '18 at 14:42
  • @egreg Well that solves the issue and explains why I was not able to find anything on the many tutorial I went through. By the way, I had no idea, you could download the source from arXiv, this is a great piece of info. Thank you! – Birdy Nam Nam Feb 08 '18 at 14:44
  • After a bit of research, I realized that draw.io had a very easy interface for curving lines. Less elegant but more efficient! Thanks to everybody! – Birdy Nam Nam Feb 08 '18 at 15:07

1 Answers1

2
\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