latex Drawing graphs TikZ -- Algorithmic graph drawing


Example

TikZ implements several algorithms for automatic graph layouts (requires LuaLaTeX).

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing,quotes}
\usegdlibrary{force}

\begin{document}
  \begin{tikzpicture}
    \graph[spring layout] {
      A -> ["1"] B, 
      A -> {C, D},
      C -> {B, D},
    };
  \end{tikzpicture}
\end{document}

enter image description here

There are several algorithms and many options to influence them. See part IV of the TikZ manual for details.