Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphDrawing: nodes=coordinate #318

Closed
pgf-tikz-bot opened this issue Jun 1, 2014 · 4 comments
Closed

GraphDrawing: nodes=coordinate #318

pgf-tikz-bot opened this issue Jun 1, 2014 · 4 comments

Comments

@pgf-tikz-bot
Copy link

Migrated from SourceForge
Author: jolx
Timestamp: 2014-06-01 10:02:44.364000

Hi,

I seem to have stumbled on a bug in your GraphDrawing library. If you want to draw a graph with interconnected nodes, I thought of using nodes with no size such as coordinates. This doesn't seem to work as shown in the example below.

This was tested using v3.0.0 of pgf/TikZ; however, it seems like it used to work in the past as indicated at http://tex.stackexchange.com/questions/86588.

\documentclass[tikz]{standalone}

\usetikzlibrary{
    graphdrawing,
    graphs
}

\usegdlibrary{
    force
}

\begin{document}

\begin{tikzpicture}
    \graph [spring layout, nodes={coordinate}] { 1--2--3--4--5--1 };
\end{tikzpicture}

\end{document}

The relevant error is:

! LuaTeX error ...graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua:213: 
...t/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path.lua:704: memoization tab
le filled incorrectly
stack traceback:
	[C]: in function 'assert'
	...graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua:213: in function 'r
esumeGraphDrawingCoroutine'
	...graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua:182: in function 'r
unGraphDrawingAlgorithm'
	[string "\directlua "]:1: in main chunk.
\pgfgdendscope ...lay.runGraphDrawingAlgorithm() }
                                                   \endgroup \directlua {pgf...
l.15 ...ut, nodes={coordinate}] { 1--2--3--4--5--1 }
                                                  ;
@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: s1lentst0rm
Timestamp: 2014-10-13 10:59:32.571000

I think I have the same problem. In the following code snippet the "cross out" shape causes problems:

\documentclass[tikz,border=0pt]{standalone}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.misc}

\begin{document}
\tikzset{cross/.style={cross out, draw=black, minimum size=2*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt},
%default radius will be 1pt.
cross/.default={1pt}}

\begin{tikzpicture}[user/.style={circle},key/.style={rectangle,rounded corners=3pt},every node/.style={gray,draw,inner sep=-3pt,minimum height=22pt, minimum width=22pt,key}, ren/.style={black,very thick}, sym/.style={very thick, Triangle-}]
\graph [edges={dashed}, tree layout, math nodes, grow=down, level distance=0.55in, sibling distance=0.1in]
{
K_O^[ren] --[sym] {
K_M -- {
K_I -- {
K_A -- {
[nodes=user] U_1, U_2
},
K_B -- {
[nodes=user] U_3, U_4
}
},
K_J -- {
K_C -- {
[nodes=user] U_5, U_6
},
K_D -- {
[nodes=user] U_7, U_8
}
}
},
K_N^
[ren] --[sym] {
K_K^[ren] --[sym] {
K_E -- {
[nodes=user] U_9, U_{10}
},
K_F^
[ren] --[white] {
U_{11}[user,cross out]
},
K_F^* --[sym] {
U_{12}[user,black]
}
},
K_L -- {
K_G -- {
[nodes=user] U_{13}, U_{14}
},
K_H -- {
[nodes=user] U_{15}, U_{16}
}
}
}
}
};
\end{tikzpicture}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-engine: luatex
%%% End:

ERROR: LuaTeX error ...graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua:213:

--- TeX said ---
...9/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path.lua:704: memoization tab
le filled incorrectly
stack traceback:
[C]: in function 'assert'
...graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua:213: in function 'r
esumeGraphDrawingCoroutine'
...graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua:182: in function 'r
unGraphDrawingAlgorithm'
[string "\directlua "]:1: in main chunk.
\pgfgdendscope ...lay.runGraphDrawingAlgorithm() }
\endgroup \directlua {pgf...
l.57 }
;
--- HELP ---
From the .log file...

The lua interpreter ran into a problem, so the
remainder of this lua chunk will be ignored.

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: jolx
Timestamp: 2015-08-17 13:31:28.468000

This bug can be fixed (or at least, temporarily circumvented) with the following patch:

--- a/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua
+++ b/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua
@@ -263,6 +263,13 @@ end

 function InterfaceToDisplay.createVertex(name, shape, path, height, binding_infos, anchors)

+  -- 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
+
   -- Setup
   local scope = InterfaceCore.topScope()
   local binding = InterfaceCore.binding

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: cfeuersaenger
Timestamp: 2015-11-28 21:20:03.144000

  • status: open --> closed-duplicate

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: cfeuersaenger
Timestamp: 2015-11-28 21:20:03.309000

The issue has been fixed in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant