1 Answers
I would do this by defining a "pic" for each "block" of dots. You can read all about these in section 18.2 of the tikz manual (version 3.0.1a). Using pics, the MWE below produces the following diagram:
The idea of the MWE, which should get you started, is to define a pic dotblock that takes two arguments: a label for the block and the number of dots. You use this pic in several different ways, including
\pic at (0,0) {dotblock={a,2}};
\draw (0,0) pic{dotblock={a,2}};
These two commands are, I believe, equivalent.
The block of dots is drawn centered vertically from the point where it is placed. The point of giving the dotblock a label is that it gives an easy way to draw edges between the dots in the blocks using their coordinates: the command
\draw(a2)--(b3);
draws a line from the second dot in "block a" to the third dot in "block b".
Here is a full MWE:
\documentclass{article}
\usepackage{tikz}
\tikzset{
pics/dotblock/.style args = {#1,#2}{% #1=label, #2=number of dots
code = {
\foreach \adot [remember=\adot as \bdot,
evaluate=\adot as \y using 0.5-\adot+#2/2] in {1,...,#2} {
\node[circle, fill=black, radius=1mm] (#1\adot) at (0.5,\y) {};
}
\draw[blue](0,-#2/2) rectangle (1,#2/2);
}
}
}
\begin{document}
\begin{tikzpicture}
\pic at (0,0) {dotblock={a,2}};
\draw (2,0) pic{dotblock={b,3}};
\pic at (4,0) {dotblock={c,1}};
\draw[red, dashed, thin](-0.2,1.7) rectangle (5.2,-1.7);
\pic at (7,0) {dotblock={d,1}};
\draw(a1)--(b3)--(c1)--(d1);
\end{tikzpicture}
\end{document}
Given that the image in the OP has essentially three different types of repeating blocks I would actually define pics for each of them and then link them up. For example, the righthand block could be done with
pics/twoBlock/.style args = {#1}{
code = {
\draw[dashed,green!80!black](0,0)--(6,0);
\draw(0,0) pic{dotblock={{#1}1,2}};
\draw(2,0) pic{dotblock={{#1}2,1}};
\draw[thin,red,dashed] (-0.2,1.2) rectangle (3.2,-1.2);
\draw(5,0) pic{dotblock={{#1}3,2}};
\draw[thin,red,dashed] (4.8,1.2) rectangle (6.2,-1.2);
}
}
so that \draw (7,0) pic{twoBlock={A}}; would produce
The twoBlock={A}, and the definition of twoBlock, means that the dots in this diagram are labelled as A11, A12, A21, A31 and A32. Notice that the green line is drawn first so that it is underneath the other objects in the picture.



tikzand the basic commands are: 1) for rectangle:\draw (X1,Y1)rectangle(X2,Y2);where 1 and 2 are "diagonally opposite" corners if you want it dashed try:\draw[dashed]...2) for circle the command is\draw[fill=black] (xcenter,yexnter) circle (0.3 cm)where 0.3 cm is the radious. 3)For line:\draw (x1,y1)--(x2,y2);Also you can useforeachcommand to avoid repeating same commands. More help after MWE. (Just added the comment so you can give a try... I think there are better options) – koleygr Sep 04 '17 at 13:15\includegraphics– David Carlisle Sep 04 '17 at 13:32