0

I am trying model a network and is new to tikz. Please let me know how to can I draw node with some outgoing edges to somewhere as given in the image below.Image that I want in my writing

Any help is appreciated.

  • you can draw from nowhere to somewhere \draw[<-] – percusse Oct 26 '16 at 15:09
2

You can define the coordinates, in absolute or relative terms, from/to where the arrows should go. Moreover, you can define coordinates in the same way as nodes, by using \coordinate instead of \node, and use their names in \draw commands. One solution:

\documentclass[tikz,border=1pt]{standalone}
\begin{document}
\begin{tikzpicture}[auto,scale=2]\scriptsize
  \node[circle,draw] (N) {N};
  \draw[<-] (N) -- node[swap,sloped]         {$\mathrm{in}_1$}  +(150:1);
  \draw[<-] (N) -- node[swap]                {$\mathrm{in}_2$}  +(180:1);
  \draw[<-] (N) -- node[sloped]              {$\mathrm{in}_3$}  +(210:1);
  \draw[->] (N) -- node[sloped]              {$\mathrm{out}_1$} +( 30:1);
  \draw[->] (N) -- node[sloped,pos=0.8]      {$\mathrm{out}_2$} +( 10:1);
  \draw[->] (N) -- node[sloped,pos=0.8,swap] {$\mathrm{out}_3$} +(-10:1);
  \draw[->] (N) -- node[sloped,swap]         {$\mathrm{out}_3$} +(-30:1);
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    Also note that instead of drawing the line in the direction of the arrow (which is annoying for the incoming arrows) you can just put the arrow on the other end of the line: `\draw[<-] (N) -- node {$\mathrm{in}_2$} +(180:1) ;' – Emma Oct 26 '16 at 15:53
  • @Emma Ah, yes, that's nice, I will change it. – gernot Oct 26 '16 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.