# Tikz - \graph command explicitly place one parent node below another parent node (connected to same child)

In the following Tikz flow diagram constructed specifically using the automatic placement of graphs using \graph construct (i.e. instead of placing nodes using the fit library),

,

how can I have the node X below node $\gamma$? The division work flow requires this in order to be mathematically correct.

The following is my LuaTeX code:

\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, fit, graphs, shapes, calc, arrows.meta, intersections}
\usetikzlibrary{graphdrawing}
\usegdlibrary{trees,layered,force}
\usepackage{mathtools}

\begin{document}
\begin{figure}
\begin{tikzpicture}[
regularnode/.style={draw,semithick, minimum width = 12mm, minimum height = 8mm},
sumnode/.style={draw,circle,semithick},
gainnode/.style={draw,isosceles triangle,semithick},
stylenode/.style={draw,semithick, minimum width = 1.2cm, minimum height = 1cm, node distance=4mm and 1.3cm},
styledecisionbox/.style={draw,semithick,shape aspect=1,diamond,inner sep=2pt},
>=Stealth,auto
]

\graph [layered layout,grow=right,level sep=1cm]
{
-> "sumofpowers"/"$\Sigma$"[sumnode]
->  "scalebydteff"/"$\alpha$" [gainnode]
->  "powerselector"/"$\beta$" [regularnode]
->  "scalebyncells"/"$\gamma$" [gainnode]
->  "scalebysurfacearea"/"$\div$" [stylenode]
->  "lionsimba"/"d"  [align=center,stylenode];
;
"surfaceareacalc"/"X"[red,minimum size=1cm,circle,draw,ultra thick,fill=green!40]-> scalebysurfacearea;
};

\end{tikzpicture}
\end{figure}
\end{document}


Use grow'=right instead grow=right to change the order of the children:

\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, fit, graphs, shapes, calc, arrows.meta, intersections}
\usetikzlibrary{graphdrawing}
\usegdlibrary{trees,layered,force}
\usepackage{mathtools}

\begin{document}
%\begin{figure}
\begin{tikzpicture}[
regularnode/.style={draw,semithick, minimum width = 12mm, minimum height = 8mm},
sumnode/.style={draw,circle,semithick},
gainnode/.style={draw,isosceles triangle,semithick},
stylenode/.style={draw,semithick, minimum width = 1.2cm, minimum height = 1cm, node distance=4mm and 1.3cm},
styledecisionbox/.style={draw,semithick,shape aspect=1,diamond,inner sep=2pt},
>=Stealth,auto
]

\graph [layered layout,grow'=right,level sep=1cm]
{
-> "sumofpowers"/"$\Sigma$"[sumnode]
->  "scalebydteff"/"$\alpha$" [gainnode]
->  "powerselector"/"$\beta$" [regularnode]
->  "scalebyncells"/"$\gamma$" [gainnode]
->  "scalebysurfacearea"/"$\div$" [stylenode]
->  "lionsimba"/"d"  [align=center,stylenode];
;
"surfaceareacalc"/"X"[red,minimum size=1cm,circle,draw,ultra thick,fill=green!40]
-> scalebysurfacearea
;
};

\end{tikzpicture}
%\end{figure}
\end{document}


Result:

But note that also the order of "1", "2", "3" and "4" is changed.

• I am afraid that this is a less than ideal solution. In my workflow, the 'X' branch (and it's upstream parents to be drawn later) comes logically after the gamma branch. Is there any other way to coax the desired placement after the gamma branch codes have been written? – Krishna Jun 14 '17 at 14:26
• @Krishna I have changed my answer. – esdd Jun 14 '17 at 14:31
• indeed that works. Thank you very much for your help. I have marked yours as the right answer. – Krishna Jun 14 '17 at 14:35