According to the SourceForge bug tracker for pgf, this appears to be a bug that was claimed to be fixed at the end of 2015. At the end of 2018, I still have this behavior in MiKTeX... plus another issue, which seems to be another bug (introduce after the OP?). There are two edits you can make to work around these problems, but they aren't exactly pretty.
Issue #1:
Using \usegdlibrary{trees} results in the following error for me on MiKTeX (up-to-date as of 2018-12-13):
! Package pgf Error: Graph drawing library 'trees' not found.
To fix this, this answer from @henri-menke (for TexLive 2018 and posted in Sep 2018) helped me also on MiKTex. Before loading \usegdlibrary{trees}, you basically need to load this Lua code:
\usepackage{luacode}
\begin{luacode}
function pgf_lookup_and_require(name)
local sep = '/'
if string.find(os.getenv('PATH'),';') then
sep = '\string\\'
end
local function lookup(name)
local sub = name:gsub('%.',sep)
local find_func = function (name, suffix)
if resolvers then
local n = resolvers.findfile (name.."."..suffix, suffix) -- changed
return (not (n == '')) and n or nil
else
return kpse.find_file(name,suffix)
end
end
if find_func(sub, 'lua') then
require(name)
elseif find_func(sub, 'clua') then
collectgarbage('stop')
require(name)
collectgarbage('restart')
else
return false
end
return true
end
return
lookup('pgf.gd.' .. name .. '.library') or
lookup('pgf.gd.' .. name) or
lookup(name .. '.library') or
lookup(name)
end
\end{luacode}
Issue #2:
Unfortunately, this only allowed me to reach the point of getting the same error as your OP inquired about. To address this, I turn back to the SourceForge bug tracker. There is a post on 2015-08-17 by JP-Ellis who has a workaround which requires you manually changing a file within the pgf package.
That fix involves adding these lines of code to the beginning of the InterfaceToDisplay.createVertex function of the InterfaceToDisplay.lua file:
-- The path should never be empty, so we create a trivial path in the provided
-- path is empty. This occurs with the `coordinate` shape for example.
if #path == 0 then
path:appendMoveto(0, 0)
path:appendClosepath()
end
Because this can be difficult for those with little or no experience. Let me explain the steps to add this chunk of code.
- Locate
[YOUR TEX INSTALLATION]/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface folder
- Copy and backup the
InterfaceToDisplay.lua file
- Open
InterfaceToDisplay.lua
- Locate
function InterfaceToDisplay.createVertex(name, shape, path, height, binding_infos, anchors) in the file
Immediately below that line (and above -- Setup) add
-- The path should never be empty, so we create a trivial path in the provided
-- path is empty. This occurs with the ``coordinate`` shape for example.
if #path == 0 then
path:appendMoveto(0, 0)
path:appendClosepath()
end
Save the file (you may need admin rights, depending on the installation)
Result after fixing issues #1 and #2:
Now your updated file from OP will look like this:
\documentclass[tikz,border=0pt]{standalone}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usetikzlibrary{shapes.misc}
%%% ADDED TO FIX ISSUE #1, (NOT ABLE TO FILE TREE GRAPH DRAWING LIBRARY)
\usepackage{luacode}
\begin{luacode}
function pgf_lookup_and_require(name)
local sep = '/'
if string.find(os.getenv('PATH'),';') then
sep = '\string\\'
end
local function lookup(name)
local sub = name:gsub('%.',sep)
local find_func = function (name, suffix)
if resolvers then
local n = resolvers.findfile (name.."."..suffix, suffix) -- changed
return (not (n == '')) and n or nil
else
return kpse.find_file(name,suffix)
end
end
if find_func(sub, 'lua') then
require(name)
elseif find_func(sub, 'clua') then
collectgarbage('stop')
require(name)
collectgarbage('restart')
else
return false
end
return true
end
return
lookup('pgf.gd.' .. name .. '.library') or
lookup('pgf.gd.' .. name) or
lookup(name .. '.library') or
lookup(name)
end
\end{luacode}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}
\graph [tree layout]
{
A -- {
B[draw,cross out]
}
};
\end{tikzpicture}
\end{document}
And the resulting image looks like this:

shapes.miscit seems, it works if you removecross out. – Torbjørn T. Oct 13 '14 at 14:29tree layoutorcross out. I need tree layout, so can you think of a workaround to cross out a node? – S1lentSt0rm Oct 13 '14 at 14:30