how can I make these diagrams with latex?

Here's some code for the second part:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{bbding}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,arrows}

\begin{document}

\newcommand\MyCross{\XSolid}

\begin{tikzpicture}[remember picture]
\begin{scope}
\matrix[matrix of nodes,column sep=-1mm] (mat1)
{
 \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & \color{red}{\MyCross} & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
};
\draw[help lines] (mat1-4-2.north west) rectangle (mat1-5-7.south east);
\draw[-latex, shorten >=-3pt, shorten <=-3pt] (mat1-4-2) to[out=180,in=130] (mat1-5-2.160);
\node[anchor=south] at (mat1.north) {A};
\end{scope}
\begin{scope}[xshift=3.8cm]
\matrix[matrix of nodes,column sep=-1mm] (mat2)
{
 \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  &  & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  &  & \color{blue}{\MyCross} & \MyCross & \MyCross & \MyCross \\
 &  &  &  &  & \MyCross & \MyCross \\
 &  &  &  &  &  & \MyCross \\
};
\draw[help lines] (mat2-4-4.north west) rectangle (mat2-5-7.south east);
\node[anchor=south] at (mat2.north) {B};
\end{scope}
\begin{scope}[xshift=8cm]
\matrix[matrix of nodes,column sep=-1mm] (mat3)
{
 \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
};
\draw[help lines] (mat3-1-4.north west) rectangle (mat3-7-5.south east);
\node[anchor=south] at (mat3.north) {A};
\end{scope}
\begin{scope}[xshift=11.8cm]
\matrix[matrix of nodes,column sep=-1mm] (mat4)
{
 \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  & \MyCross & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  &  & \MyCross & \MyCross & \MyCross & \MyCross \\
 &  &  & \color{red}{\MyCross} & \MyCross & \MyCross & \MyCross \\
 &  &  &  &  & \MyCross & \MyCross \\
 &  &  &  &  &  & \MyCross \\
};
\draw[help lines] (mat4-1-4.north west) rectangle (mat4-5-5.south east);
\draw[-latex, shorten >=-3pt, shorten <=-3pt] (mat4-5-5) to[out=270,in=-40] (mat4-5-4.-80);
\node[anchor=south] at (mat4.north) {B};
\end{scope}
\draw ( $ (mat2-1-7)!.5!(mat3-1-1) + (0,0.5) $ ) -- +(0,-4.6);
\end{tikzpicture}

\end{document}

enter image description here

And here'ssome code for the first part (building on phimuemue's code):

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=1.5]
\foreach \x in {0,...,9} {
  \node at (\x-.35,-0.6) {$v_{\x}$};
}
\clip (-0.3,-1.3) rectangle (8.3,4.3);
\foreach \x in {0,...,8} {
  \foreach \y in {0,...,4} {
    \node at  (\x cm,\y cm) (g-\x-\y) {$G_{\x,\y}$};
  }
}
\foreach \y in {0,...,3} {
  \foreach \x in {0,...,8} {
    \draw[->,shorten <=2pt,shorten >=7pt] (g-\x-\y) -- +(0,20pt);
  }
}
\foreach \y in {0,...,4} {
  \foreach \x in {0,...,7} {
    \draw[->,shorten >=2pt,shorten >=7pt] (g-\x-\y) -- +(20pt,0);
  }
}
\foreach \y in {0,...,3} {
  \foreach \x in {1,...,8} {
    \draw[->] (\x-.3,\y+.3) -- (\x - .6, \y+.6);  
  }
}
\foreach \x in {0,...,11} {
  \draw[dashed,thick] (\x-4.35,5) -- (\x + .65, 0);
}
\end{tikzpicture}

\end{document}

enter image description here


No complete working solution, but at least something to start with (for the first diagram, second ones should be simpler):

\begin{tikzpicture}[scale=1.2]
  \foreach \x in {0,...,8} {
    \foreach \y in {0,...,4} {
      \node at  (\x cm,\y cm) {$G_{\x,\y}$};
      \draw[->] (\x-.3,\y+.3) -- (\x - .6, \y+.6);
      \draw[->] (\x-.2,\y+.3) -- (\x - .2, \y+.6);
      \draw[->] (\x+.3,\y) -- (\x + .6, \y);
    }
  }
  \foreach \x in {0,...,7} {
    \draw[dashed,thick] (\x-1.35,5) -- (\x + 3.65, 0);
  }
\end{tikzpicture}

Tags:

Tikz Pgf