使用graphdrawing库插入箭头

使用graphdrawing库插入箭头,graph,latex,tikz,graph-drawing,Graph,Latex,Tikz,Graph Drawing,我想链接数字6->5和5->4,但我不知道怎么做 我的代码如下 \documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{graphdrawing} \usetikzlibrary{graphs} \usegdlibrary{trees} \begin{document} \begin{tikzpicture}[>=stealth, every node/.style={rectangle, rounded corners,

我想链接数字6->5和5->4,但我不知道怎么做

我的代码如下

\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}
这是输出:

节点可以通过其名称访问,因此您只需在它们之间绘制箭头即可:

% !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}

问tex问题的好地方是,更多的人会在那里看到你的问题并能够帮助你。