I would like to draw simple graphs in latex with tikz.
My figure that I would like to produce looks like this and I would like to put it in beamer.
I would like to draw simple graphs in latex with tikz.
My figure that I would like to produce looks like this and I would like to put it in beamer.
I define some building blocks and then use tikzcd
for typesetting the blocks:
\documentclass{article}
\usepackage{tikz-cd}
\newcommand{\pairsolid}{\bullet \arrow[r] \& \bullet}
\newcommand{\pairdashed}{\bullet \arrow[r,dashed] \& \bullet}
\begin{document}
\[
\begin{tikzcd}[nodes={inner sep=-1pt},arrows=-,ampersand replacement=\&]
\pairdashed \& \pairsolid \& \pairsolid \& \pairdashed \\
\pairsolid \& \pairdashed \& \pairsolid \& \pairsolid \\
\pairdashed \& \pairdashed \& \pairdashed \& \pairdashed
\end{tikzcd}
\]
\end{document}
You can reduce the distances:
\documentclass{article}
\usepackage{tikz-cd}
\newcommand{\pairsolid}{\bullet \arrow[r] \& \bullet}
\newcommand{\pairdashed}{\bullet \arrow[r,dashed] \& \bullet}
\begin{document}
\[
\begin{tikzcd}[
nodes={inner sep=-1pt},
arrows=-,
ampersand replacement=\&,
row sep=1ex,
column sep=1.2em,
]
\pairdashed \& \pairsolid \& \pairsolid \& \pairdashed \\
\pairsolid \& \pairdashed \& \pairsolid \& \pairsolid \\
\pairdashed \& \pairdashed \& \pairdashed \& \pairdashed
\end{tikzcd}
\]
\end{document}