\documentclass{article}
\usepackage{com.braju.graphicalmodels}
\usepackage{amsmath}
% \special{papersize=40mm,80mm}
% \setlength{\pdfpagewidth}{40mm}
% \setlength{\pdfpageheight}{80mm}
% \usepackage[vcentering,dvips]{geometry}
% \geometry{papersize={80mm,120mm},total={80mm,120mm},margin=0mm}



\catcode`\@=11%

\pagestyle{empty}

\begin{document}
\TeXtoEPS

\LARGE
\psset{unit=10mm,arrowscale=1.5,linewidth=1.5pt}

\begin{pspicture}(0,0)(12,5)
  \SpecialCoor

  \rput(2.0,1.0){\circlenode{x_1}{$x_1$}}
  \rput(5.0,1.0){\circlenode{x_2}{$x_2$}}
  \rput(8.0,1.0){\circlenode{x_3}{$x_3$}}
  \rput(11.0,1.0){\circlenode{x_4}{$x_4$}}
  \ncbox[boxsize=1,nodesep=0.5,linearc=0.25]{x_1}{x_2}
  \rput(3.5,2.0){\rnode{g1}{}}
  \ncbox[boxsize=0.8,nodesep=0.5,linearc=0.25]{x_2}{x_3}
  \rput(6.5,1.8){\rnode{g2}{}}
  \ncbox[boxsize=1,nodesep=0.5,linearc=0.25]{x_3}{x_4}
  \rput(9.5,2.0){\rnode{g3}{}}
  \rput(2.0,4.0){\rnode{h_11}{$h_1^1$}}
  \rput(3.5,4.0){\rnode{h_12}{$h_2^1$}}
  \rput(5.0,4.0){\rnode{h_13}{$h_3^1$}}
  \rput(8.0,4.0){\rnode{h_21}{$h_1^2$}}
  \rput(9.5,4.0){\rnode{h_22}{$h_2^2$}}
  \rput(11.0,4.0){\rnode{h_23}{$h_3^2$}}

  \psset{nodesep=3pt,arrows=-}
  \ncline{h_11}{g1}  \naput[npos=0.3]{\large{$w^1$}}
  \ncline{h_12}{g2}  \naput[npos=0.4]{\large{$w^1$}}
  \ncline{h_13}{g3}  \naput[npos=0.2]{\large{$w^1$}}
  \ncline{h_21}{g1}  \naput[npos=0.05]{\large{$w^2$}}
  \ncline{h_22}{g2}  \naput[npos=0.05]{\large{$w^2$}}
  \ncline{h_23}{g3}  \naput[npos=0.05]{\large{$w^2$}}         
\end{pspicture}

\endTeXtoEPS
\end{document}
