我尝试编译此示例来绘制图形:https://texample.net/tikz/examples/drawing-graphs/
但是,如果我在 TexWorks (pdfLatex 或 Overleaf) 中编译
% Drawing a graph using the PG 3.0 graphdrawing library
% Author: Mark Wibrow
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[>=stealth, every node/.style={circle, draw, minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
{
4 -> {
3 -> { 1 -> { 5, " " }, 2,2 },
3 -> { 1, 2, 2 },
3 -> { 1, 2, 2 }
}
};
\end{tikzpicture}
\end{document}
我收到这样的错误:
Package pgfkeys Error: I do not know the key '/tikz/graphs/grow', to which you passed 'down', and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/graph drawing/anchor at', to which you passed '(\tikz@lastx ,\tikz@lasty )', and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/tikz/graphs/sibling distance', to which you passed '0.5in', and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/tikz/graphs/tree layout' and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/tikz/graphs/level distance', to which you passed '0.5in', and I am going to ignore it. Perhaps you misspelled it.
我期望看到的图表:
但是我遇到了错误:
我假设必须使用 LuaLatex,但事实上门户上有很多很好的例子,并且布局是使用 pdfLatex 完成的