# Drawing graph with nodes having multiple inputs and outputs

How can you draw a graph with nodes having multiple inputs and outputs and edges connecting individual inputs and outputs? Like in the following image. Image source

• use of \pic can be handy, but first show us what you try so far! – Zarko Mar 1 '18 at 22:12
• So far I've drawn an image on piece of paper and used it in the Latex document :D I know how to draw graphs using tikz, but I haven't found anything like this in the gallery or online examples. – DikobrAz Mar 1 '18 at 22:24

\documentclass[tikz, border = 3pt]{standalone}

\usetikzlibrary{quotes}

\tikzset{
node23/.pic ={
\coordinate (A) at (0, 0);
\coordinate (B) at (2, 3.5);
\draw[pic actions] (A) rectangle (B) node [pos = 0.5]{\large\tikzpictext};
\foreach \y in {0.5, 1.5, 2.5} \fill[pic actions] (2, \y) rectangle (2.5, \y + 0.5);
\foreach \y in {0.75, 2.25} \fill[pic actions] (0, \y) rectangle (-0.5, \y + 0.5);
},
node12/.pic ={
\coordinate (A) at (0, 0);
\coordinate (B) at (2, 2.5);
\draw[pic actions] (A) rectangle (B) node [pos = 0.5]{\large\tikzpictext};
\foreach \y in {0.5, 1.5} \fill[pic actions] (2, \y) rectangle (2.5, \y + 0.5);
\foreach \y in {1.0} \fill[pic actions] (0, \y) rectangle (-0.5, \y + 0.5);
}
}

\begin{document}
\begin{tikzpicture}
\pic[color = red, "F"] (F) {node23};
\pic[color = blue , "r"] (r) at (4, 0) {node12};
\pic[color = orange , "G"] (G) at (8, 0) {node23};
\pic[color = cyan , "H"] (H) at (8, -4) {node23};
\draw[->] (2.6, 2.75) -- (3.4, 1.25);
\draw[->] (6.6, 1.75) -- (7.4, 2.50);
\draw[->] (6.6, 0.75) -- (7.4, -1.50);
\end{tikzpicture}
\end{document}