1

I would like to link numbers 6 -> 5 and 5 -> 4 but I have no clue on how to do it.

My code is as follows

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}
\begin{document}

\begin{tikzpicture}[>=stealth, every node/.style={rectangle, rounded corners, draw, minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
    {
    Flight 0 -> { 
      Flight 1 -> { 4 -> , 5},
      Flight 2 -> { 6 },
      Flight 3 -> { 7,8 }
    } 
};
\end{tikzpicture}
\end{document}

This is the output: Graph

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
M. Mike
  • 37
  • 5

1 Answers1

1

The nodes can be accessed by their name so you can simply draw arrows between them:

% !TeX TS-program = lualatex

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}
\begin{document}

\begin{tikzpicture}[>=stealth, every node/.style={rectangle, rounded corners, draw, minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
    {
    Flight 0 -> { 
      Flight 1 -> { 4 , 5},
      Flight 2 -> { 6 },
      Flight 3 -> { 7,8 }
    } 
};
\draw[->] (6) -- (5);
\draw[->] (5) -- (4);
\end{tikzpicture}
\end{document}

enter image description here