0

enter image description here

I am new to Latex, i have to draw above diagram in latex. Can any one please help me, How to draw above network diagram in Latex.

  • I am new to latex. i don't have any code for above image. I was searching in net but i didn't get any related code for above image. can you help how to draw above diagram in latex. – user3815361 Dec 2 '15 at 20:15
  • You might consider the Ipe drawing editor, which has nice LaTeX integration and would likely be faster than coding such a diagram by hand in PGF/TikZ. – G. Poore Dec 2 '15 at 20:47
2

You can have that with pstricks. It can be compiled with pdflatex if you launch it with the switch --enable-write18 (MiKTeX) or --shell-escape (TeX Live, MacTeX).

\documentclass[border=3pt, x11names]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}%
\usepackage{lmodern}
\usepackage{mathtools}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\pagestyle{empty}

\begin{document}

\begin{pspicture}(-2,-6)(7,6)
    \everypsbox{\scriptsize}
    \psset{linewidth=0.5pt, dotsize=4pt, linecolor=SlateGray3, yunit=0.5, arrowinset=0.15, shortput=nab, linejoin =1}
    \multido{\i=2 + 1}{4}{\dotnode[href = 2ex, vref = 2ex](0,\i){A\i}}
    \multido{\i=2 + 1}{4}{\dotnode[href = 2ex, vref = 2ex](0,-\i){B\i}}
    \pnodes(-1ex,5){A’}(-1ex,-5){B’}
    \psset{yunit=1.33}
    \multido{\i=1+1}{4}{\dotnode(4,\i){C\i}}
    \pnodes(4.15,4){D}(4.15,1){C}
    \uput[u](0,4.5){\em item}
    \uput[u](4,4.5){\em container}
    \psset{linecolor=black, arrows=-> , arrowinset=0.15, labelsep=1pt, npos=0.6}
    \ncline{A5}{C4}\naput{$1$}
    \ncline{A5}{C3}\naput{$2$}
    \ncline{A5}{C2}\naput{$3$}
    \ncline{B5}{C1}\naput{$\mathrm {j\times i}$}
    \psset{braceWidthInner=3pt,braceWidthOuter=3pt, braceWidth =0.6pt, nodesepA =-5pt}
    \psbrace[rot=180](A’)(B’){$ j $}
    \psbrace[nodesepA=1pt](C)(D){$ i $}
    \psset{linestyle=dotted, linewidth=0.8pt, linecolor=black, arrows=-, nodesep=8pt}
    \ncline{A2}{B2}
    \pcline[offset=2.4cm, nodesep =-3pt](C1)(C2)
\end{pspicture}

\end{document} 

enter image description here

0

Here's a version done with luamplib using the TeX Gyre Termes fonts. Process with lualatex.

enter image description here

\documentclass[margin=5mm]{standalone}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes}
\setmathfont{TeX Gyre Termes Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
u := 20;
z0 = (u,u); z1 = (7u,u);
label(btex \textit{item}      etex, z0);
label(btex \textit{container} etex, z1);

path a[], c; picture dot;
a1 = (x0, 0)  -- (x1, 0);
a2 = (x0, 0)  -- (x1,-1.2u);
a3 = (x0, 0)  -- (x1,-2.4u);
a4 = (x0,-8u) -- (x1,-3.6u);
c = fullcircle scaled 4;
dot = image(fill c withcolor .67[blue, white]; draw c);

label.top(btex $1$ etex, point 0.6 of a1);
label.top(btex $2$ etex, point 0.6 of a2);
label.top(btex $3$ etex, point 0.6 of a3);
label.ulft(btex $j\times i$ etex, point 0.68 of a4);
label(btex $\vdots$ etex, 1/3[point 0.6 of a3, point 0.6 of a4]);
label(btex $\vdots$ etex, 1/2[point 0 of a1, point 0 of a4]);

for i=1 upto 4:
  drawarrow a[i] cutafter c shifted point 1 of a[i];
endfor
for i=1 upto 4:
  draw dot shifted point 1 of a[i];
  draw dot shifted point 0 of a1 shifted (0,u*(1-i));
  draw dot shifted point 0 of a4 shifted (0,u*(i-1));
endfor

vardef vbrace(expr a,b,n,m,s) =
  save offset, midpoint, bearing; 
  pair offset, midpoint, bearing; 
  offset = right scaled n;
  midpoint = 1/2[a,b] shifted (m,0);
  bearing = unitvector(b-a);
  label(s,midpoint+8unitvector(offset));
  (a {offset} ... 
  1/2[a,midpoint]{bearing} ... 
  {offset}
  midpoint 
  {-offset} ... 
  1/2[midpoint,b]{bearing} ...
  {-offset} b) shifted offset
enddef;

draw vbrace(point 0 of a1, point 0 of a4, -5, -12, btex $j$ etex);
draw vbrace(point 1 of a1, point 1 of a4,  5,  12, btex $i$ etex);

endfig;
\end{mplibcode}
\end{document}

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.