I need to draw an image like this:

I saw this and this, but I could not modify it properly. Basically, I could not write the on the labels. Need your help.
Here's an idea how to do it:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
[ cnode/.style={draw=black,fill=#1,minimum width=3mm,circle},
]
\node[cnode=red,label=0:$\Sigma$] (s) at (6,-3) {};
\node at (0,-4) {$\vdots$};
\node at (3,-4) {$\vdots$};
\foreach \x in {1,...,4}
{ \pgfmathparse{\x<4 ? \x : "n"}
\node[cnode=blue,label=180:$x_{\pgfmathresult}$] (x-\x) at (0,{-\x-div(\x,4)}) {};
\node[cnode=gray,label=90:$\varphi_{\pgfmathresult}$] (p-\x) at (3,{-\x-div(\x,4)}) {};
\draw (p-\x) -- node[above,sloped,pos=0.3] {$\omega_{\pgfmathresult}$} (s);
}
\foreach \x in {1,...,4}
{ \foreach \y in {1,...,4}
{ \draw (x-\x) -- (p-\y);
}
}
\end{tikzpicture}
\end{document}

\draw (a) -- node[above,sloped] {x} (b);for the edges and\node[label=90:$\varphi_1$] (phi1) at (x,y) {};? – Tom Bombadil Oct 26 '13 at 16:10