diff --git a/doc/generic/pgf/text-en/pgfmanual-en-library-patterns.tex b/doc/generic/pgf/text-en/pgfmanual-en-library-patterns.tex index ecf666c40..542aff4f1 100644 --- a/doc/generic/pgf/text-en/pgfmanual-en-library-patterns.tex +++ b/doc/generic/pgf/text-en/pgfmanual-en-library-patterns.tex @@ -257,7 +257,7 @@ \subsection{User-Defined Patterns} The following settings can be used to reproduce the other |... lines| patterns. % -\begin{codeexample}[preamble={\usetikzlibrary{patterns.meta}}] +\begin{codeexample}[preamble={\usetikzlibrary{patterns,patterns.meta}}] \begin{tikzpicture} \draw[pattern={horizontal lines},pattern color=orange] (0,0) rectangle +(1,1); @@ -315,7 +315,7 @@ \subsection{User-Defined Patterns} The following settings can be used to reproduce the |grid| and |crosshatch| patterns. % -\begin{codeexample}[preamble={\usetikzlibrary{patterns.meta}}] +\begin{codeexample}[preamble={\usetikzlibrary{patterns,patterns.meta}}] \begin{tikzpicture} \draw[pattern={grid},pattern color=orange] (0,0) rectangle +(1,1); @@ -363,7 +363,7 @@ \subsection{User-Defined Patterns} The following settings can be used to reproduce the |dots| and |crosshatch dots| patterns. % -\begin{codeexample}[preamble={\usetikzlibrary{patterns.meta}}] +\begin{codeexample}[preamble={\usetikzlibrary{patterns,patterns.meta}}] \begin{tikzpicture} \draw[pattern={dots},pattern color=orange] (0,0) rectangle +(1,1); @@ -413,7 +413,7 @@ \subsection{User-Defined Patterns} Number of pointy ends of the stars. \end{key} % -\begin{codeexample}[preamble={\usetikzlibrary{patterns.meta}}] +\begin{codeexample}[preamble={\usetikzlibrary{patterns,patterns.meta}}] \begin{tikzpicture} \draw[pattern={fivepointed stars},pattern color=orange] (0,0) rectangle +(1,1); diff --git a/doc/generic/pgf/text-en/pgfmanual-en-tikz-graphs.tex b/doc/generic/pgf/text-en/pgfmanual-en-tikz-graphs.tex index f2237a372..0667dfe0d 100644 --- a/doc/generic/pgf/text-en/pgfmanual-en-tikz-graphs.tex +++ b/doc/generic/pgf/text-en/pgfmanual-en-tikz-graphs.tex @@ -243,8 +243,9 @@ \subsubsection{Concept: Chain Groups} As can be seen, the placement is not particularly nice by default, use the algorithms from the graph drawing libraries to get a better layout. For -instance, adding |tree layout| to the above code results in the following -somewhat more pleasing rendering: +instance, adding |tree layout| to the above code (and +|\usetikzlibrary{graphdrawing}| as well as |\usegdlibrary{trees}| to the +preamble) results in the following somewhat more pleasing rendering: % \ifluatex \medskip diff --git a/doc/generic/pgf/text-en/pgfmanual-en-tikz-matrices.tex b/doc/generic/pgf/text-en/pgfmanual-en-tikz-matrices.tex index 19adb8db0..f46ad79b7 100644 --- a/doc/generic/pgf/text-en/pgfmanual-en-tikz-matrices.tex +++ b/doc/generic/pgf/text-en/pgfmanual-en-tikz-matrices.tex @@ -557,8 +557,8 @@ \subsubsection{Cell Styles and Options} even odd column, row, even odd row, - cell - } + cell, + }, } \end{codeexample} % @@ -581,8 +581,8 @@ \subsubsection{Cell Styles and Options} column, row, cell, - /tikz/my style - } + /tikz/my style, + }, } \end{codeexample} % diff --git a/doc/generic/pgf/version-for-luatex/en/pgfmanual-test.tex b/doc/generic/pgf/version-for-luatex/en/pgfmanual-test.tex index 98b08b3f7..87757b6f9 100644 --- a/doc/generic/pgf/version-for-luatex/en/pgfmanual-test.tex +++ b/doc/generic/pgf/version-for-luatex/en/pgfmanual-test.tex @@ -10,13 +10,16 @@ \documentclass[a4paper]{ltxdoc} % pgf version is defined in \pgfversion in file -% generic/pgf/utilities/pgfrcs.code.tex +% generic/pgf/utilities/pgfrcs.code.tex \input{../pgfmanual-luatex.cfg} \input{../../text-en/pgfmanual-en-main-preamble.tex} \begin{document} -\include{pgfmanual-en-library-patterns} +%\include{pgfmanual-en-library-patterns} + +\include{pgfmanual-en-gd-phylogenetics} +%\includeluadocumentationof{pgf.gd.pedigrees.library} \end{document} diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua index 72a82be97..1073e2b58 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua @@ -59,10 +59,18 @@ declare { than one node of a component, the node encountered first in the component is used. "]], - examples = [[" - \tikz \graph [binary tree layout, nodes={draw}] - { a, b -- c[align here], d -- e[second, align here] -- f }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [binary tree layout, nodes={draw}] + { a, b -- c[align here], d -- e[second, align here] -- f }; + "]], + }} } --- @@ -200,11 +208,19 @@ declare { suggest, the components will be placed left-to-right and they are aligned such that their top nodes are in a line. "]], - examples = [[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go right top aligned] - { a, "high\\node" -- b}; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go right top aligned] + { a, "high\\node" -- b}; + "]] + }} } --- @@ -222,11 +238,19 @@ declare { This means that the components will be aligned with their bounding boxed being top-aligned. "]], - examples = [[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go right absolute top aligned] - { a, "high\\node" -- b}; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go right absolute top aligned] + { a, "high\\node" -- b}; + "]] + }} } --- @@ -295,11 +319,19 @@ declare { summary = "See the other |components go ...| keys.", - examples = [[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go left top aligned] - { a, "high\\node" -- b}; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go left top aligned] + { a, "high\\node" -- b}; + "]] + }} } --- @@ -381,15 +413,26 @@ declare { }, summary = "See the other |components go ...| keys.", - examples = {[[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go down left aligned] - { a, hello -- {world,s} }; - "]],[[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go up absolute left aligned] - { a, hello -- {world,s}}; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go down left aligned] + { a, hello -- {world,s} }; + "]] + },{ + code = [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go up absolute left aligned] + { a, hello -- {world,s}}; + "]] + } } } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua index f941ff226..f014e48a1 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua @@ -38,19 +38,32 @@ declare { by this option in any way. You can use the |grow| option or |orient| options to orient individual components. "]], - examples = {[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component direction=left] - { a, b, c -- d -- e, f -- g }; - "]],[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component direction=10] - { a, b, c -- d -- e, f -- g }; - "]],[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component direction=up] - { a, b, c [grow=right] -- d -- e, f[grow=45] -- g }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component direction=left] + { a, b, c -- d -- e, f -- g }; + "]] + },{ + code = [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component direction=10] + { a, b, c -- d -- e, f -- g }; + "]] + },{ + code = [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component direction=up] + { a, b, c [grow=right] -- d -- e, f[grow=45] -- g }; + "]] + } } } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua index 78537b614..0f51caf47 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua @@ -58,15 +58,26 @@ declare { As above, but in decreasing order. \end{itemize} "]], - examples = {[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component order=by first specified node] - { a, b, c, f -- g, c -- d -- e }; - "]],[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component order=increasing node number] - { a, b, c -- d -- e, f -- g }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component order=by first specified node] + { a, b, c, f -- g, c -- d -- e }; + "]] + },{ + code = [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component order=increasing node number] + { a, b, c -- d -- e, f -- g }; + "]] + } } } @@ -94,11 +105,19 @@ declare { summary = [[" A shorthand for |component order=decreasing node number|. "]], - examples = [[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - large components first] - { a, b, c -- d -- e, f -- g }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + large components first] + { a, b, c -- d -- e, f -- g }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua index c5019a56e..c512d8d28 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua @@ -107,19 +107,30 @@ declare { support laying out unconnected graphs, this option has no effect; rather it works as if this option were always set. "]], - examples = {[[" - \tikz \graph [simple necklace layout] - { - a -- b -- c -- d -- a, - 1 -- 2 -- 3 -- 1 - }; - "]],[[", - \tikz \graph [simple necklace layout, componentwise] - { - a -- b -- c -- d -- a, - 1 -- 2 -- 3 -- 1 - }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{circular} + }, + "]], + code = [[" + \tikz \graph [simple necklace layout] + { + a -- b -- c -- d -- a, + 1 -- 2 -- 3 -- 1 + }; + "]] + },{ + code = [[", + \tikz \graph [simple necklace layout, componentwise] + { + a -- b -- c -- d -- a, + 1 -- 2 -- 3 -- 1 + }; + "]] + } } } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua index 6dc5a1301..2441e2d43 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua @@ -62,18 +62,26 @@ declare { desired distance, for instance in case the nodes are too big. In this case, the \meta{length} is just considered as a lower bound. "]], - examples = [[" - \begin{tikzpicture} - \graph [simple necklace layout, node distance=1cm, node sep=0pt, - nodes={draw,circle,as=.}] - { - 1 -- 2 [minimum size=2cm] -- 3 -- - 4 -- 5 -- 6 -- 7 --[orient=up] 8 - }; - \draw [red,|-|] (1.center) -- ++(0:1cm); - \draw [red,|-|] (5.center) -- ++(180:1cm); - \end{tikzpicture} - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{circular} + }, + "]], + code = [[" + \begin{tikzpicture} + \graph [simple necklace layout, node distance=1cm, node sep=0pt, + nodes={draw,circle,as=.}] + { + 1 -- 2 [minimum size=2cm] -- 3 -- + 4 -- 5 -- 6 -- 7 --[orient=up] 8 + }; + \draw [red,|-|] (1.center) -- ++(0:1cm); + \draw [red,|-|] (5.center) -- ++(180:1cm); + \end{tikzpicture} + "]] + }} } @@ -94,14 +102,25 @@ declare { front''. This make sense only for some algorithms, like for a simple necklace layout. "]], - examples = {[[" - \tikz \graph [simple necklace layout, node distance=0cm, nodes={circle,draw}] - { 1--2--3--4--5--1 }; - "]],[[" - \tikz \graph [simple necklace layout, node distance=0cm, node sep=0mm, - nodes={circle,draw}] - { 1--2--3[node pre sep=5mm]--4--5[node pre sep=1mm]--1 }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{circular} + }, + "]], + code = [[" + \tikz \graph [simple necklace layout, node distance=0cm, nodes={circle,draw}] + { 1--2--3--4--5--1 }; + "]] + },{ + code = [[" + \tikz \graph [simple necklace layout, node distance=0cm, node sep=0mm, + nodes={circle,draw}] + { 1--2--3[node pre sep=5mm]--4--5[node pre sep=1mm]--1 }; + "]] + } } } @@ -150,15 +169,23 @@ declare { instance in case the nodes are too big. In this case, the \meta{length} is just considered as a lower bound. "]], - examples = [[" - \begin{tikzpicture}[inner sep=2pt] - \draw [help lines] (0,0) grid (3.5,2); - \graph [layered layout, level distance=1cm, level sep=0] - { 1 [x=1,y=2] -- 2 -- 3 -- 1 }; - \graph [layered layout, level distance=5mm, level sep=0] - { 1 [x=3,y=2] -- 2 -- 3 -- 1, 3 -- {4,5} -- 6 -- 3 }; - \end{tikzpicture} - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \begin{tikzpicture}[inner sep=2pt] + \draw [help lines] (0,0) grid (3.5,2); + \graph [layered layout, level distance=1cm, level sep=0] + { 1 [x=1,y=2] -- 2 -- 3 -- 1 }; + \graph [layered layout, level distance=5mm, level sep=0] + { 1 [x=3,y=2] -- 2 -- 3 -- 1, 3 -- {4,5} -- 6 -- 3 }; + \end{tikzpicture} + "]] + }} } --- @@ -188,15 +215,23 @@ declare { behave like the ``padding'' keys rather than the ``margin'' key of cascading style sheets. "]], - examples = [[" - \begin{tikzpicture}[inner sep=2pt, level sep=0pt, sibling distance=0pt] - \draw [help lines] (0,0) grid (3.5,2); - \graph [layered layout, level distance=0cm, nodes=draw] - { 1 [x=1,y=2] -- {2,3[level pre sep=1mm],4[level pre sep=5mm]} -- 5 }; - \graph [layered layout, level distance=0cm, nodes=draw] - { 1 [x=3,y=2] -- {2,3,4} -- 5[level pre sep=5mm] }; - \end{tikzpicture} - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \begin{tikzpicture}[inner sep=2pt, level sep=0pt, sibling distance=0pt] + \draw [help lines] (0,0) grid (3.5,2); + \graph [layered layout, level distance=0cm, nodes=draw] + { 1 [x=1,y=2] -- {2,3[level pre sep=1mm],4[level pre sep=5mm]} -- 5 }; + \graph [layered layout, level distance=0cm, nodes=draw] + { 1 [x=3,y=2] -- {2,3,4} -- 5[level pre sep=5mm] }; + \end{tikzpicture} + "]] + }} } --- @@ -278,18 +313,31 @@ declare { For some layouts, like a simple necklace layout, the \meta{length} is measured as the distance on the circle. "]], - examples = {[[" - \tikz \graph [tree layout, sibling distance=1cm, nodes={circle,draw}] - { 1--{2,3,4,5} }; - "]],[[" - \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, - nodes={circle,draw}] - { 1--{2,3,4,5} }; - "]],[[" - \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, - nodes={circle,draw}] - { 1--{2,3[sibling distance=1cm],4,5} }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, sibling distance=1cm, nodes={circle,draw}] + { 1--{2,3,4,5} }; + "]] + },{ + code = [[" + \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, + nodes={circle,draw}] + { 1--{2,3,4,5} }; + "]] + },{ + code = [[" + \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, + nodes={circle,draw}] + { 1--{2,3[sibling distance=1cm],4,5} }; + "]] + } } } @@ -304,11 +352,19 @@ declare { summary = [[" Works like |level pre sep|, only for siblings. "]], - examples = [[" - \tikz \graph [tree layout, sibling distance=0cm, nodes={circle,draw}, - sibling sep=0pt] - { 1--{2,3[sibling pre sep=1cm],4,5} }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, sibling distance=0cm, nodes={circle,draw}, + sibling sep=0pt] + { 1--{2,3[sibling pre sep=1cm],4,5} }; + "]] + }} } --- @@ -412,25 +468,36 @@ declare { connected components will have when they are placed next to each other. "]], - examples = {[[" - \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, - components go right top aligned, - component sep=1pt, nodes=draw] + examples = { { - 1 -> 2 -> {3->4[second]->5,6,7}; - a -> b[second] -> c[second] -> d -> e; - x -> y[second] -> z -> u[second] -> v; - }; - "]],[[" - \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, - components go right top aligned, - component sep=1em, nodes=draw] - { - 1 -> 2 -> {3->4[second]->5,6,7}; - a -> b[second] -> c[second] -> d -> e; - x -> y[second] -> z -> u[second] -> v; - }; - "]] + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, + components go right top aligned, + component sep=1pt, nodes=draw] + { + 1 -> 2 -> {3->4[second]->5,6,7}; + a -> b[second] -> c[second] -> d -> e; + x -> y[second] -> z -> u[second] -> v; + }; + "]] + },{ + code = [[" + \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, + components go right top aligned, + component sep=1em, nodes=draw] + { + 1 -> 2 -> {3->4[second]->5,6,7}; + a -> b[second] -> c[second] -> d -> e; + x -> y[second] -> z -> u[second] -> v; + }; + "]] + } } } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua index 87d67b5b5..ced54e48c 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua @@ -37,12 +37,20 @@ declare { after the algorithm has computed something. "]], - examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b, c, d[nudge=(up:2mm)]} -- e -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b, c, d[nudge=(up:2mm)]} -- e -- a; + }; + "]] + }} } @@ -57,12 +65,20 @@ declare { }, summary = "A shorthand for nudging a node upwards.", - examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b, c, d[nudge up=2mm]} -- e -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b, c, d[nudge up=2mm]} -- e -- a; + }; + "]] + }} } @@ -90,12 +106,20 @@ declare { }, summary = "Like |nudge up|, but left.", - examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b, c, d[nudge left=2mm]} -- e -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b, c, d[nudge left=2mm]} -- e -- a; + }; + "]] + }} } --- @@ -125,12 +149,20 @@ declare { afterwards, the node is placed there, regardless of what the algorithm has computed (all other nodes are unaffected). "]], - examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b,c,d[regardless at={(1,0)}]} -- e -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b,c,d[regardless at={(1,0)}]} -- e -- a; + }; + "]] + }} } @@ -154,11 +186,19 @@ declare { regardless. The name of the key is intended to remind one of a node being ``nailed'' to the canvas. "]], - examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b,c,d[nail at={(1,0)}]} -- e[nail at={(1.5,-1)}] -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b,c,d[nail at={(1,0)}]} -- e[nail at={(1.5,-1)}] -- a; + }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua index 80aa7ef42..e264e3953 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua @@ -161,15 +161,23 @@ declare { could draw a sort of ``inside edge''. "]], - examples = { [[" - \tikz \graph [no layout, nodes={draw, minimum size=20pt}] { - a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] - }; - "]],[[" - \tikz \graph [no layout, nodes={draw, minimum size=20pt}, - allow inside edges=false] { - a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] - }; - "]] + examples = { + { + options = [[" + preamble={\usetikzlibrary{graphs,graphdrawing}}, + "]], + code = [[" + \tikz \graph [no layout, nodes={draw, minimum size=20pt}] { + a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] + }; + "]] + },{ + code = [[" + \tikz \graph [no layout, nodes={draw, minimum size=20pt}, + allow inside edges=false] { + a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] + }; + "]] + } } } \ No newline at end of file diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua index 1890fa4f3..2ca38037a 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua @@ -69,19 +69,30 @@ declare { and so forth as \meta{direction} and also |up|, |down|, |left|, and |right|. Also, you can specify |-| for ``right'' and \verb!|! for ``down''. "]], - examples = {[[" - \tikz \graph [spring layout] + examples = { { - a -- { b, c, d, e -- {f, g, h} }; - h -- [orient=30] a; - }; - "]],[[" - \tikz \graph [spring layout] - { - a -- { b, c, d[> orient=right], e -- {f, g, h} }; - h -- a; - }; - "]] + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout] + { + a -- { b, c, d, e -- {f, g, h} }; + h -- [orient=30] a; + }; + "]] + },{ + code = [[" + \tikz \graph [spring layout] + { + a -- { b, c, d[> orient=right], e -- {f, g, h} }; + h -- a; + }; + "]] + } } } @@ -97,13 +108,21 @@ declare { Same as |orient|, only the rest of the graph should be flipped relative to the connection line. "]], - examples = [[" - \tikz \graph [spring layout] - { - a -- { b, c, d[> orient'=right], e -- {f, g, h} }; - h -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout] + { + a -- { b, c, d[> orient'=right], e -- {f, g, h} }; + h -- a; + }; + "]] + }} } --- @@ -116,17 +135,28 @@ declare { Specifies the tail vertex for the orientation of a graph. See |orient| for details. "]], - examples = {[[" - \tikz \graph [spring layout] { - a [orient=|, orient tail=f] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz \graph [spring layout] { - a [orient=down, orient tail=h] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout] { + a [orient=|, orient tail=f] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]] + },{ + code = [[" + \tikz \graph [spring layout] { + a [orient=down, orient tail=h] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]] + } } } @@ -144,17 +174,28 @@ declare { Specifies the head vertex for the orientation of a graph. See |orient| for details. "]], - examples = {[[" - \tikz \graph [spring layout] + examples = { { - a [orient=|, orient head=f] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz \graph [spring layout] { a -- b -- c -- a }; - \tikz \graph [spring layout, orient=10, - orient tail=a, orient head=b] { a -- b -- c -- a }; - "]] + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout] + { + a [orient=|, orient head=f] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]] + },{ + code = [[" + \tikz \graph [spring layout] { a -- b -- c -- a }; + \tikz \graph [spring layout, orient=10, + orient tail=a, orient head=b] { a -- b -- c -- a }; + "]] + } } } @@ -169,10 +210,18 @@ declare { |orient=0|. The tail will be everything before the part ``| to |'' and the head will be everything following it. "]], - examples = [[" - \tikz \graph [spring layout] { a -- b -- c -- a }; - \tikz \graph [spring layout, horizontal=a to b] { a -- b -- c -- a }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout] { a -- b -- c -- a }; + \tikz \graph [spring layout, horizontal=a to b] { a -- b -- c -- a }; + "]] + }} } @@ -204,10 +253,18 @@ declare { summary = [[" A shorthand for specifying |orient tail|, |orient head| and |orient=-90|. "]], - examples = [[" - \tikz \graph [spring layout] { a -- b -- c -- a }; - \tikz \graph [spring layout, vertical=a to b] { a -- b -- c -- a }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout] { a -- b -- c -- a }; + \tikz \graph [spring layout, vertical=a to b] { a -- b -- c -- a }; + "]] + }} } @@ -257,26 +314,39 @@ declare { When you give the |grow=right| key to the graph as a whole, it will be applied to all nodes. This happens to be exactly what you want: "]], - examples = {[[" - \tikz \graph [layered layout, sibling distance=5mm] - { - a [grow=right] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz \graph [layered layout, grow=right, sibling distance=5mm] + examples = { { - a -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz - \graph [layered layout, grow=-80] - { - {a,b,c} --[complete bipartite] {e,d,f} - --[complete bipartite] {g,h,i}; - }; - "]] + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [layered layout, sibling distance=5mm] + { + a [grow=right] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]] + },{ + code = [[" + \tikz \graph [layered layout, grow=right, sibling distance=5mm] + { + a -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]] + },{ + code = [[" + \tikz + \graph [layered layout, grow=-80] + { + {a,b,c} --[complete bipartite] {e,d,f} + --[complete bipartite] {g,h,i}; + }; + "]] + } } } @@ -288,13 +358,21 @@ declare { type = "direction", summary = "Same as |grow|, only with the children in clockwise order.", - examples = [[" - \tikz \graph [layered layout, sibling distance=5mm] - { - a [grow'=right] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [layered layout, sibling distance=5mm] + { + a [grow'=right] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua index df7ce68dd..8d59c016e 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua @@ -53,11 +53,19 @@ declare { This behavior can be changed using this option. When the key is invoked, nodes are placed \emph{behind} the edges. "]], - examples = [[" - \tikz \graph [simple necklace layout, nodes={draw,fill=white}, - nodes behind edges] - { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs.standard,graphdrawing} + \usegdlibrary{circular,examples} + }, + "]], + code = [[" + \tikz \graph [simple necklace layout, nodes={draw,fill=white}, + nodes behind edges] + { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; + "]] + }} } @@ -72,11 +80,19 @@ declare { summary = [[" This is the default placement of edges: Behind the nodes. "]], - examples = [[" - \tikz \graph [simple necklace layout, nodes={draw,fill=white}, - edges behind nodes] - { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs.standard,graphdrawing} + \usegdlibrary{circular,examples} + }, + "]], + code = [[" + \tikz \graph [simple necklace layout, nodes={draw,fill=white}, + edges behind nodes] + { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; + "]] + }} } --- @@ -117,15 +133,26 @@ declare { For instance, in a |layered layout|, an edge with a large |weight| will be as short as possible. "]], - examples = {[[" - \tikz \graph [layered layout] { - a -- {b,c,d} -- e -- a; - }; - "]],[[" - \tikz \graph [layered layout] { - a -- {b,c,d} -- e --[weight=3] a; - }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [layered layout] { + a -- {b,c,d} -- e -- a; + }; + "]] + },{ + code = [[" + \tikz \graph [layered layout] { + a -- {b,c,d} -- e --[weight=3] a; + }; + "]] + } } } @@ -141,13 +168,20 @@ declare { Sets the ``length'' of an edge. Algorithms may take this value into account when drawing a graph. "]], - examples = {[[" - \tikz \graph [phylogenetic tree layout] { - a --[length=2] b --[length=1] {c,d}; - a --[length=3] e - }; - "]], - } + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics,trees} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout] { + a --[length=2] b --[length=1] {c,d}; + a --[length=3] e + }; + "]], + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua index d69d5fc6c..182ba0e93 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua @@ -57,20 +57,28 @@ declare { expected to be higher than graphics where this feature is not applied. The following example demonstrates how coarsening can improve the - quality of graph drawings generated with Walshaw's algorihtm + quality of graph drawings generated with Walshaw's algorithm |spring electrical layout'|. "]], - examples = [[" - \tikz \graph [spring electrical layout', coarsen=false, vertical=3 to 4] - { - { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } - }; - - \tikz \graph [spring electrical layout', coarsen, vertical=3 to 4] - { - { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring electrical layout', coarsen=false, vertical=3 to 4] + { + { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } + }; + + \tikz \graph [spring electrical layout', coarsen, vertical=3 to 4] + { + { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } + }; + "]] + }} } --- @@ -95,15 +103,23 @@ declare { in the two graphs, the nodes are placed at exactly two and four coordinates in the final drawing. "]], - examples = [[" - \tikz \graph [spring layout, iterations=0, - minimum coarsening size=2] - { subgraph C_n [n=8] }; - - \tikz \graph [spring layout, iterations=0, - minimum coarsening size=4] - { subgraph C_n [n=8] }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs.standard,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout, iterations=0, + minimum coarsening size=2] + { subgraph C_n [n=8] }; + + \tikz \graph [spring layout, iterations=0, + minimum coarsening size=4] + { subgraph C_n [n=8] }; + "]] + }} } --- @@ -131,18 +147,26 @@ declare { multilevel approach may not produce drawings as good as with a lower |downsize ratio|. "]], - examples = [[" - % 1. ratio too high, coarsening stops early, benefits are lost - \tikz \graph [spring electrical layout', - downsize ratio=1.0, - node distance=7mm, vertical=3 to 4] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; - - % 2. ratio set to default, coarsening benefits are visible - \tikz \graph [spring electrical layout', - downsize ratio=0.2, - node distance=7mm, vertical=3 to 4] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + % 1. ratio too high, coarsening stops early, benefits are lost + \tikz \graph [spring electrical layout', + downsize ratio=1.0, + node distance=7mm, vertical=3 to 4] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + + % 2. ratio set to default, coarsening benefits are visible + \tikz \graph [spring electrical layout', + downsize ratio=0.2, + node distance=7mm, vertical=3 to 4] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua index c9f129c28..6564b5f6a 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua @@ -41,7 +41,12 @@ declare { "]], examples = { { - options = [["preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}}"]], + options = [[" + preamble={ + \usetikzlibrary{graphs.standard,graphdrawing} + \usegdlibrary{force} + }, + "]], code = [[" \tikz \graph [spring electrical layout, horizontal=0 to 1] { 0 [electric charge=1] -- subgraph C_n [n=10] }; diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua index b8d96630c..a35ac62ee 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua @@ -47,17 +47,32 @@ declare { The examples shows two drawings generated using two different |iteration| limits. "]], - examples = {[[" - \tikz \graph [spring layout, iterations=10] { subgraph K_n [n=4] }; - "]],[[" - \tikz \graph [spring layout, iterations=500] { subgraph K_n [n=4] }; - "]],[[" - \tikz \graph [spring electrical layout, iterations=10] - { subgraph K_n [n=4] }; - "]],[[" - \tikz \graph [spring electrical layout, iterations=500] - { subgraph K_n [n=4] }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs.standard,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout, iterations=10] { subgraph K_n [n=4] }; + "]] + },{ + code = [[" + \tikz \graph [spring layout, iterations=500] { subgraph K_n [n=4] }; + "]] + },{ + code = [[" + \tikz \graph [spring electrical layout, iterations=10] + { subgraph K_n [n=4] }; + "]] + },{ + code = [[" + \tikz \graph [spring electrical layout, iterations=500] + { subgraph K_n [n=4] }; + "]] + } } } @@ -97,13 +112,24 @@ declare { Hu2006 spring electrical, and Walshaw2000 spring electrical use a cooling factor of |0.95|. "]], - examples = {[[" - \tikz \graph [spring layout, cooling factor=0.1] - { a -> b -> c -> a }; - "]],[[" - \tikz \graph [spring layout, cooling factor=0.5] - { a -> b -> c -> a }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout, cooling factor=0.1] + { a -> b -> c -> a }; + "]] + },{ + code = [[" + \tikz \graph [spring layout, cooling factor=0.5] + { a -> b -> c -> a }; + "]] + } } } @@ -120,17 +146,24 @@ declare { below $k \cdot \meta{tolerance}$. This tolerance factor can be changed with the convergence tolerance option: "]], - examples = {[[" - \tikz \graph [spring layout, convergence tolerance=0.001] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; - "]],[[" - \tikz \graph [spring layout, convergence tolerance=1.0] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} + }, + "]], + code = [[" + \tikz \graph [spring layout, convergence tolerance=0.001] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + "]] + },{ + code = [[" + \tikz \graph [spring layout, convergence tolerance=1.0] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + "]] + } } } - - - - diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua index 71005d852..9b0c1071e 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua @@ -26,14 +26,14 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- The following examples shows how a simple graph can be scaled by -- changing the |node distance|: -- % --- \begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +-- \begin{codeexample}[preamble={\usetikzlibrary{graphs.standard,graphdrawing} -- \usegdlibrary{force}}] -- \tikz \graph [spring layout, node distance=7mm] { subgraph C_n[n=3] }; -- \tikz \graph [spring layout] { subgraph C_n[n=3] }; -- \tikz \graph [spring layout, node distance=15mm]{ subgraph C_n[n=3] }; -- \end{codeexample} -- % --- \begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +-- \begin{codeexample}[preamble={\usetikzlibrary{graphs.standard,graphdrawing} -- \usegdlibrary{force}}] -- \tikz \graph [spring electrical layout, node distance=0.7cm] { subgraph C_n[n=3] }; -- \tikz \graph [spring electrical layout] { subgraph C_n[n=3] }; diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua index c91818dc3..3f26e27a1 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua @@ -71,27 +71,38 @@ declare { routing. This will look visually quite pleasing if you add the |rounded corners| option: "]], - examples = {[[" - \tikz \graph [layered layout, sibling distance=7mm] + examples = { { - a -> { - b, - c -> { d, e, f } - } -> - h -> - a - }; - "]],[[" - \tikz [rounded corners] \graph [layered layout, sibling distance=7mm] - { - a -> { - b, - c -> { d, e, f } - } -> - h -> - a - }; - "]] + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [layered layout, sibling distance=7mm] + { + a -> { + b, + c -> { d, e, f } + } -> + h -> + a + }; + "]] + },{ + code = [[" + \tikz [rounded corners] \graph [layered layout, sibling distance=7mm] + { + a -> { + b, + c -> { d, e, f } + } -> + h -> + a + }; + "]] + } } } @@ -108,11 +119,19 @@ declare { causes an edge to become shorter, a larger |minimum layers| value causes an edge to be longer. "]], - examples = [[" - \tikz \graph [layered layout] { - a -- {b [> minimum layers=3], c, d} -- e -- a; - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [layered layout] { + a -- {b [> minimum layers=3], c, d} -- e -- a; + }; + "]] + }} } @@ -127,42 +146,53 @@ declare { a on the same layer of a layered layout (this option is also known as |same rank|). You use it like this: "]], - examples = {[[" - \tikz \graph [layered layout] { - a -- b -- c -- d -- e; - - { [same layer] a, b }; - { [same layer] d, e }; - }; - "]],[[" - \tikz [rounded corners] \graph [layered layout] { - 1972 -> 1976 -> 1978 -> 1980 -> 1982 -> 1984 -> 1986 -> 1988 -> 1990 -> future; - - { [same layer] 1972, Thompson }; - { [same layer] 1976, Mashey, Bourne }, - { [same layer] 1978, Formshell, csh }, - { [same layer] 1980, esh, vsh }, - { [same layer] 1982, ksh, "System-V" }, - { [same layer] 1984, v9sh, tcsh }, - { [same layer] 1986, "ksh-i" }, - { [same layer] 1988, KornShell ,Perl, rc }, - { [same layer] 1990, tcl, Bash }, - { [same layer] "future", POSIX, "ksh-POSIX" }, - - Thompson -> { Mashey, Bourne, csh -> tcsh}, - Bourne -> { ksh, esh, vsh, "System-V", v9sh -> rc, Bash}, - { "ksh-i", KornShell } -> Bash, - { esh, vsh, Formshell, csh } -> ksh, - { KornShell, "System-V" } -> POSIX, - ksh -> "ksh-i" -> KornShell -> "ksh-POSIX", - Bourne -> Formshell, - - { [edge={draw=none}] - Bash -> tcl, - KornShell -> Perl - } - }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} + }, + "]], + code = [[" + \tikz \graph [layered layout] { + a -- b -- c -- d -- e; + + { [same layer] a, b }; + { [same layer] d, e }; + }; + "]] + },{ + code = [[" + \tikz [rounded corners] \graph [layered layout] { + 1972 -> 1976 -> 1978 -> 1980 -> 1982 -> 1984 -> 1986 -> 1988 -> 1990 -> future; + + { [same layer] 1972, Thompson }; + { [same layer] 1976, Mashey, Bourne }, + { [same layer] 1978, Formshell, csh }, + { [same layer] 1980, esh, vsh }, + { [same layer] 1982, ksh, "System-V" }, + { [same layer] 1984, v9sh, tcsh }, + { [same layer] 1986, "ksh-i" }, + { [same layer] 1988, KornShell ,Perl, rc }, + { [same layer] 1990, tcl, Bash }, + { [same layer] "future", POSIX, "ksh-POSIX" }, + + Thompson -> { Mashey, Bourne, csh -> tcsh}, + Bourne -> { ksh, esh, vsh, "System-V", v9sh -> rc, Bash}, + { "ksh-i", KornShell } -> Bash, + { esh, vsh, Formshell, csh } -> ksh, + { KornShell, "System-V" } -> POSIX, + ksh -> "ksh-i" -> KornShell -> "ksh-POSIX", + Bourne -> Formshell, + + { [edge={draw=none}] + Bash -> tcl, + KornShell -> Perl + } + }; + "]] + } } } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua index 32927530a..493405039 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua @@ -73,16 +73,19 @@ declare { documentation = [[" ... "]], - examples = [[" - \tikz \graph [simple pedigree layout, default edge operator=complete bipartite] - { - Eve -- [mate] Felix; - { Eve, Felix } -> [child] { George, Hank }; - - Alice -- [mate] Bob; - { Alice, Bob } -> [child] { Charly, Dave, Eve }; - }; - "]] + examples = {{ + options = [["preamble={\usetikzlibrary{graphs,graphdrawing}"]], + code = [[" + \tikz \graph [simple pedigree layout, default edge operator=complete bipartite] + { + Eve -- [mate] Felix; + { Eve, Felix } -> [child] { George, Hank }; + + Alice -- [mate] Bob; + { Alice, Bob } -> [child] { Charly, Dave, Eve }; + }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua index 04e1ca49f..379296687 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua @@ -43,16 +43,24 @@ declare { The evolutionary length of the edges must be specified through the use of the |length| key for each edge. "]], - examples = [[" - \tikz \graph [phylogenetic tree layout] { - a -- { - b [>length=2] --[length=1] { c, d }, - e [>length=3] - } - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics,trees} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout] { + a -- { + b [>length=2] --[length=1] { c, d }, + e [>length=3] + } + }; + "]] + }} } - + function AuthorDefinedPhylogeny:run() diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua index ef40f0ee6..2a73ecde6 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua @@ -47,20 +47,28 @@ declare { nodes. After every insertion the distance matrix has to be updated. "]], - examples = [[" - \tikz \graph [phylogenetic tree layout, - balanced minimum evolution, - grow'=right, sibling distance=0pt, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout, + balanced minimum evolution, + grow'=right, sibling distance=0pt, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua index a9acc4886..712e26e55 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua @@ -52,20 +52,28 @@ declare { documentation = [[" ... "]], - examples = [[" - \tikz \graph [phylogenetic tree layout, - rooted rectangular phylogram, - balanced minimum evolution, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout, + rooted rectangular phylogram, + balanced minimum evolution, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; + "]] + }} } --- @@ -94,20 +102,29 @@ declare { documentation = [[" ... "]], - examples = [[" - \tikz \graph [phylogenetic tree layout, - rooted straight phylogram, - balanced minimum evolution, grow=right, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; - "]]} + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout, + rooted straight phylogram, + balanced minimum evolution, grow=right, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; + "]] + }} +} --- declare { @@ -134,20 +151,28 @@ declare { documentation = [[" ... "]], - examples = [[" - \tikz \graph [phylogenetic tree layout, - unrooted rectangular phylogram, - balanced minimum evolution, grow=right, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout, + unrooted rectangular phylogram, + balanced minimum evolution, grow=right, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; + "]] + }} } --- @@ -168,20 +193,28 @@ declare { documentation = [[" ... "]], - examples = [[" - \tikz \graph [phylogenetic tree layout, - unrooted straight phylogram, - balanced minimum evolution, grow=right, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout, + unrooted straight phylogram, + balanced minimum evolution, grow=right, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua index 242ccf183..f79902dc3 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua @@ -40,18 +40,26 @@ declare { documentation = [[" ... "]], - examples = [[" - \tikz \graph [phylogenetic tree layout, upgma, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout, upgma, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua index 6a665b673..7485bcead 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua @@ -45,19 +45,27 @@ declare { This algorithm uses a distance matrix, ideally an ultrametric one, to compute the graph. "]], - examples = [[" - \tikz \graph [phylogenetic tree layout, sibling distance=0pt, sibling sep=2pt, - unweighted pair group method using arithmetic averages, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{phylogenetics} + }, + "]], + code = [[" + \tikz \graph [phylogenetic tree layout, sibling distance=0pt, sibling sep=2pt, + unweighted pair group method using arithmetic averages, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; + "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua index 9e5b8d72e..c31bacb89 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua @@ -31,16 +31,22 @@ InterfaceToAlgorithms.declare { documentation = [[" The planar layout is a pipeline of algorithms to produce a crossings-free drawing of a planar graph. - First a combinatorical embedding of the graph is created using + First a combinatorial embedding of the graph is created using the Algorithm from Boyer and Myrvold. - The combinatorical Embedding is then being improved by + The combinatorial Embedding is then being improved by by the Sort and Flip algorithm and triangulated afterwards. To determine the actual node positions the shift method by de Fraysseix, Pach and Pollack is used. Finally the force based Planar Drawing Postprocessing improves the drawing. "]], - examples = { - [[" + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" \tikz \graph [nodes={draw, circle}] { a -- { b -- { @@ -59,9 +65,9 @@ InterfaceToAlgorithms.declare { f --[no span edge] g, c --[no span edge] d, e --[no span edge] c - } + }; "]] - } + }} } function PlanarLayout:run() diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua index 603f2ee7c..bbfc44f98 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua @@ -19,7 +19,7 @@ declare { summary = [[" Whether or not to use the Sort and Flip Algorithm - to improve the combinatorical embedding. + to improve the combinatorial embedding. "]] } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua index defcf9f8c..e468d1ebb 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua @@ -50,13 +50,21 @@ declare { to 7 in the example. "]], - examples = [[" - \tikz \graph [simple necklace layout, node distance=1.5cm, - necklace routing, - nodes={draw,circle}, edges={>={Stealth[round,sep,bend]}}] - { 1 -> 2 [minimum size=30pt] <- 3 <-> 4 -- - 5 -- 6 -- [bend left] 7 -- 1 -- 4 }; + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{arrows.meta,bending,graphs,graphdrawing} + \usegdlibrary{circular,routing} + }, + "]], + code = [[" + \tikz \graph [simple necklace layout, node distance=1.5cm, + necklace routing, + nodes={draw,circle}, edges={>={Stealth[round,sep,bend]}}] + { 1 -> 2 [minimum size=30pt] <- 3 <-> 4 -- + 5 -- 6 -- [bend left] 7 -- 1 -- 4 }; "]] + }} } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua index 815f90d26..ca898bde8 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua @@ -101,10 +101,18 @@ declare { every node with a single child, this child will be the first child and the second child will be missing. "]], - examples = [[" - \tikz \graph [binary tree layout,level distance=5mm] - { a -> { b->c->d, e->f->g } }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [binary tree layout,level distance=5mm] + { a -> { b->c->d, e->f->g } }; + "]] + }} } --- @@ -151,22 +159,39 @@ declare { the |right| and |left| keys are already in use for anchoring. Naturally, you can locally redefine them, if you want. "]], - examples = {[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> b[second] }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b[second], c} }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b, c[first]} }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b[second], c[second]} }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b[third], c[first], d} }; - "]] + examples = { + { + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> b[second] }; + "]] + },{ + code = [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b[second], c} }; + "]] + },{ + code = [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b, c[first]} }; + "]] + },{ + code = [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b[second], c[second]} }; + "]] + },{ + code = [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b[third], c[first], d} }; + "]] + } } } diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua index dacf63486..7f7f4f7f5 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua @@ -237,20 +237,28 @@ declare { preferred in the computation of the spanning tree, but use |no span edge| to cause the algorithm to ignore these edges. "]], - examples = [[" - \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, - every group/.style={ - default edge kind=->, no span edge, - path=source}] - { - 5 -> { - "1,3" -> {0,2,4}, - 11 -> { - "7,9" -> { 6, 8, 10 } + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, + every group/.style={ + default edge kind=->, no span edge, + path=source}] + { + 5 -> { + "1,3" -> {0,2,4}, + 11 -> { + "7,9" -> { 6, 8, 10 } + } } - } - }; - "]] + }; + "]] + }} } @@ -406,16 +414,24 @@ declare { This strategy is nice with trees specified with both forward and backward edges. "]], - examples = [[" - \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, - span using directed] - { - 3 <- 5[root] -> 8, - 1 <- 3 -> 4, - 7 <- 8 -> 9, - 1 -- 4 -- 7 -- 9 - }; - "]] + examples = {{ + options = [[" + preamble={ + \usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{trees} + }, + "]], + code = [[" + \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, + span using directed] + { + 3 <- 5[root] -> 8, + 1 <- 3 -> 4, + 7 <- 8 -> 9, + 1 -- 4 -- 7 -- 9 + }; + "]] + }} } ---