5

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.enter image description here

Kira
  • 53
  • Welcome to TeX.SX! Do you have some ideas about it to share or are you just stumped from the beginning? – egreg May 11 '15 at 21:53
  • What are bipartite graphs? I'm afraid they just look like squiggles to me, but I'm sure there's more to it than that. – cfr May 11 '15 at 22:04

1 Answers1

4

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}

enter image description here

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}

enter image description here

egreg
  • 1,121,712