1

I was compiling the following code to render a graph which I copied from internet.

\documentclass{article}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{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}

The command I used to compile the code was:

luatex test.tex

(test.tex is the file I used to save the code above)

I got an error showing the picture below:
enter image description here

Please help me to solve this. Any help is welcome. Thanks in advance.

[Update]

I changed luatex to lualtex. But new errors coming. enter image description here

[Update v2]

According to comment from sergiokapone, I add a \usepackage{tikz} in preamble as follows:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{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}

The two compiled results still with errors: enter image description here

[Update 3]

Thank Torbjørn T for your help. How stupid i am!! I forget to save the updated files. However I always save files on linux using vim. but i am using notepad++ on windows for this test. So I forget the saving...

The file has been successfully compiled and produce the following result. enter image description here

Thanks again!

  • 2
    use lualatex test.tex .... – Thruston Jun 3 '17 at 14:34
  • 1
    @alban Your code is successfully compiled after the update (I'm use TeXLive2016 on Win10). Can you show log-file? – sergiokapone Jun 3 '17 at 14:50
  • 2
    the error you show in the final image is not from the file where you had added \usepackage{tikz} – David Carlisle Jun 3 '17 at 14:52
  • 2
    please show the log file from lualatex on your updated file – David Carlisle Jun 3 '17 at 15:06
  • 4
    I'm voting to close this question as off-topic because the OP forgot to save the updated file. – Henri Menke Jun 15 '17 at 7:57

Browse other questions tagged or ask your own question.