**Context**
[Marmot's method](https://tex.stackexchange.com/questions/532650/mindmaps-general-method-to-get-regular-harmonious-circle-shape-for-level-3-and) enables to shape regular mindmaps (see examples below) based on redefinition of the growing cycle. It simplifies everything. I tested it on 30 mindmaps and it's flawless. I use one for each chapter and students find it really useful.
**My question**
The cherry on this beautiful cake would be an automation process to count the nodes at each level.
**How to implement it ?**
"I think that a fully automatic solution will have to go in two runs . In order to know what the various angles should be, one would have to know how many children the later children at the same level have, and then the number of grandchildren and so on. Conceivably one could write the information to the aux file and recover it in the second run."
and then :/
**Examples**
![image.png](/image?hash=7cf5749db2e41e379291c088d796b419cc3d6977b87630b584f0cacfe1732cf6)
![image.png](/image?hash=65321b11763947048b140a91338cb3e3a0a6d962c8299e838bc9d383bf662f2c)
![image.png](/image?hash=468e765462c2c60189610c84cdc3104a21565a8ccd790b5ae16e0e8d42744762)
![image.png](/image?hash=cf86bfaa6bf8389ec8eb0098736d51750d87cf65f765580638cc85a097201b96)
![image.png](/image?hash=7e95069ea8ee5521bae60c046456476c1505648a2366ac76ab7ff99a96e0f3ab)
![image.png](/image?hash=9a13acbc3bb5ef18dd92a1fdcccb187aab49961f23f61b82c6f962c9772af6d6)
**MWE**
```
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{mindmap,shadows}
\definecolor{myuniversity}{RGB}{36, 0, 132}
% growCycle
\makeatletter
\newif\ifmmap@debug
\mmap@debugfalse
\newcommand{\mmap@debug@message}[1]{\ifmmap@debug
\typeout{#1}%
\fi}
\newcount\tikzcountchildi
\newcount\tikzcountchildii
\newcount\tikzcountchildiii
\newcount\tikzcountchildiv
\newcount\tikzcountchildv
\tikzcountchildi=0
\tikzcountchildii=0
\tikzcountchildiii=0
\tikzcountchildiv=0
\tikzcountchildv=0
\tikzset{Julien growth/.style={growth function=\tikz@grow@Julien,
mmap/initialize counts},
mmap/.cd,initialize counts/.code={\global\tikzcountchildi=0%
\global\tikzcountchildii=0%
\global\tikzcountchildiii=0%
\global\tikzcountchildiv=0%
\global\tikzcountchildv=0%
}
}
\def\tikz@grow@Julien{%
\pgftransformreset%
\pgftransformshift{\pgfpoint{\pgfkeysvalueof{/tikz/mmap/overall xshift}}%
{\pgfkeysvalueof{/tikz/mmap/overall yshift}}}%
\ifcase\tikztreelevel
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildi}%
\global\advance\tikzcountchildi by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildii}%
\global\advance\tikzcountchildii by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildiii}%
\global\advance\tikzcountchildiii by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildiv}%
\global\advance\tikzcountchildiv by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildv}%
\global\advance\tikzcountchildv by1\relax%
\fi
\mmap@debug@message{level=\the\tikztreelevel,%
\the\tikzcountchildi,\the\tikzcountchildii,\the\tikzcountchildiii,
rotation=\pgfutil@tempb,sibling angle=\pgfkeysvalueof{/tikz/sibling angle}}%
\pgftransformrotate{\pgfutil@tempb}%
\pgftransformxshift{\the\tikzleveldistance}%
}
\makeatother
\tikzset{%
mmap/.cd,
name/.initial=undef,
overall rotation/.initial=0,
overall xshift/.initial=0pt,
overall yshift/.initial=0pt,
sign/.initial=1,
child weight/.initial=0.5,
/tikz/.cd,
offset angle/.initial=0, %%% Not exist anymore
Xshift/.style={xshift=#1,mmap/overall xshift=#1},
Yshift/.style={yshift=#1,mmap/overall yshift=#1},
branch color/.style={
concept color=#1!80,ball color=#1!50,
every child/.append style={concept color=#1!50},
}
}
\begin{document}
\def\ShapeAngle{180} % half circle
\def\Rotation{0}
\def\DistOne{5cm}
\def\DistTwo{8cm}
\def\DistThree{11cm}
\def\OffsetLevelThree{0}
% Part to automate
\def\AngleLevelOne{\ShapeAngle/2} % 3 nodes @ level 1
\def\AngleLevelTwo{\ShapeAngle/8} % 9 nodes @ level 2
\def\AngleLevelThree{\ShapeAngle/17}% 18 nodes @ level 3
\begin{tikzpicture}%[node font=\sffamily]
\begin{scope}
[ text width=1.5cm,
align=flush center,
mindmap,Julien growth,
mmap/overall rotation=\Rotation,mmap/sign=1,
every node/.style={concept,circular drop shadow,execute at begin node=\hskip0pt,text=white},
node font=\sffamily,
nodes={concept},
concept color=myuniversity!70,
root concept/.append style={ball color=myuniversity!50, line width=1.5ex,text=white,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},
level 1/.style={level distance=\DistOne,font=\large,minimum size=2.5cm,text width=2.0cm, sibling angle=\AngleLevelOne},
level 2/.style={level distance=\DistTwo,font=\normalsize,minimum size=1.5cm,text width=1.5cm, sibling angle=\AngleLevelTwo},
level 3/.style={level distance=\DistThree,font=\normalsize,minimum size=1.5cm,text width=1.5cm, sibling angle=\AngleLevelThree,offset angle=\OffsetLevelThree},
]
\node[root concept] {Bonds}
child[branch color=myuniversity] {node {Issuer}
child {node {Risques de crédit}
child {node {Subordination}}
child {node {Rating}}
child {node {Credit spread}}
}
child {node {Type d'émission}
child {node {Standalone} }
child {node {Program} }
}
child {node {Funding}
child {node {Devise} }
child {node {Maturité} }
child {node {Coupon} }
}
}
child {node {Cash flow}
child {node {Coupon Fixe}}
child {node {Coupon variable}
child {node {Taux variable}}
child {node {Taux révisable}}
}
child {node {Cancellable}
child {node {Callable}}
child {node {Putable}}
}
}
child[branch color=myuniversity] {node {Pricing}
child {node {Curves}
child {node {Spot}}
child {node {Forwards}}
}
child {node {Modèle}
child {node {Discret}}
child {node {Continue}}
}
child {node {Sensibilités}
child {node {Duration}}
child {node {Convexity}}
}
}
;
\end{scope}
\end{tikzpicture}
\end{document}
```
**EDIT for an overlap issue I can't spot**
```
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{mindmap,shadows}
\definecolor{myuniversity}{RGB}{36, 0, 132}
% growCycle
\makeatletter
\newif\ifmmap@debug
\mmap@debugfalse
\newcommand{\mmap@debug@message}[1]{\ifmmap@debug
\typeout{#1}%
\fi}
\def\tikz@mmap@store@aux#1#2{%
\immediate\write\@mainaux{\string\expandafter\xdef\noexpand\csname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\string\endcsname{#2}}}%
\def\tikz@mmap@get@from@aux#1#2{%
\ifcsname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\endcsname
\edef#2{\csname pgfk@/tikz/mmap/\pgfkeysvalueof{/tikz/mmap/name}/#1\endcsname}%
\else
\edef#2{0}%
\fi
}
\pgfmathdeclarefunction{MMapNodesAtLevel}{1}{%
\tikz@mmap@get@from@aux{n-\@roman{#1}}{\pgfmathresult}}
\newcount\tikzcountchildi
\newcount\tikzcountchildii
\newcount\tikzcountchildiii
\newcount\tikzcountchildiv
\newcount\tikzcountchildv
\newcount\tikzcountchildvi
\tikzcountchildi=0
\tikzcountchildii=0
\tikzcountchildiii=0
\tikzcountchildiv=0
\tikzcountchildv=0
\tikzcountchildvi=0
\tikzset{Julien growth/.style={growth function=\tikz@grow@Julien,
mmap/initialize counts,
/tikz/execute at end scope={%
\tikz@mmap@store@aux{n-i}{\the\tikzcountchildi}%
\tikz@mmap@store@aux{n-ii}{\the\tikzcountchildii}%
\tikz@mmap@store@aux{n-iii}{\the\tikzcountchildiii}%
\tikz@mmap@store@aux{n-iv}{\the\tikzcountchildiv}%
\tikz@mmap@store@aux{n-v}{\the\tikzcountchildv}%
\tikz@mmap@store@aux{n-vi}{\the\tikzcountchildvi}%
}},
mmap/.cd,initialize counts/.code={\global\tikzcountchildi=0%
\global\tikzcountchildii=0%
\global\tikzcountchildiii=0%
\global\tikzcountchildiv=0%
\global\tikzcountchildv=0%
\global\tikzcountchildvi=0%
}
}
\def\tikz@grow@Julien{%
\pgftransformreset%
\pgftransformshift{\pgfpoint{\pgfkeysvalueof{/tikz/mmap/overall xshift}}%
{\pgfkeysvalueof{/tikz/mmap/overall yshift}}}%
\ifcase\tikztreelevel
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildi}%
\global\advance\tikzcountchildi by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildii}%
\global\advance\tikzcountchildii by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildiii}%
\global\advance\tikzcountchildiii by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildiv}%
\global\advance\tikzcountchildiv by1\relax%
\or
\pgfmathsetmacro{\pgfutil@tempb}{\pgfkeysvalueof{/tikz/mmap/overall rotation}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/offset angle}%
+\pgfkeysvalueof{/tikz/mmap/sign}*\pgfkeysvalueof{/tikz/sibling angle}*\tikzcountchildv}%
\global\advance\tikzcountchildv by1\relax%
\fi
\mmap@debug@message{level=\the\tikztreelevel,%
\the\tikzcountchildi,\the\tikzcountchildii,\the\tikzcountchildiii,
rotation=\pgfutil@tempb,sibling angle=\pgfkeysvalueof{/tikz/sibling angle}}%
\pgftransformrotate{\pgfutil@tempb}%
\pgftransformxshift{\the\tikzleveldistance}%
}
\makeatother
\tikzset{%
mmap/.cd,
name/.initial=undef,
overall rotation/.initial=0,
overall xshift/.initial=0pt,
overall yshift/.initial=0pt,
sign/.initial=1,
child weight/.initial=0.5,
/tikz/.cd,
offset angle/.initial=0, %%% Not exist anymore
Xshift/.style={xshift=#1,mmap/overall xshift=#1},
Yshift/.style={yshift=#1,mmap/overall yshift=#1},
branch color/.style={
concept color=#1!80,ball color=#1!50,
every child/.append style={concept color=#1!50},
}
}
\begin{document}
\def\ShapeAngle{360} % circle
\def\Rotation{0}
\def\DistOne{5cm}
\def\DistTwo{8cm}
\def\DistThree{12cm}
\def\OffsetLevelThree{0}
\begin{tikzpicture}%[node font=\sffamily]
\begin{scope}
[ text width=1.5cm,
align=flush center,
mindmap,Julien growth,
mmap/overall rotation=\Rotation,mmap/sign=1,
mmap/name=semicirc,%<- you need unique names if you want to use several mindmaps
every node/.style={concept,circular drop shadow,execute at begin node=\hskip0pt,text=black},
node font=\sffamily,
nodes={concept},
concept color=myuniversity!70,
root concept/.append style={ball color=myuniversity!50, line width=1.5ex,text=black,font=\huge\bfseries\scshape,minimum size=4.5cm,text width=4.5cm,},
level 1/.style={level distance=\DistOne,font=\large,minimum size=2.5cm,text width=2.0cm,
sibling angle/.evaluated={\ShapeAngle/max((MMapNodesAtLevel(1)-1),1)}},
level 2/.style={level distance=\DistTwo,font=\normalsize,minimum size=1.5cm,text width=1.5cm,
sibling angle/.evaluated={\ShapeAngle/max((MMapNodesAtLevel(2)-1),1)}},
level 3/.style={level distance=\DistThree,font=\normalsize,minimum size=1.5cm,text width=1.5cm,
sibling angle/.evaluated={\ShapeAngle/max((MMapNodesAtLevel(3)-1),1)},
offset angle=\OffsetLevelThree},
]
\node[root concept] {Programme}
child[branch color=brown] { node {Terme}
child { node {Forward}
child { node {Taylor made} }
child { node {Pricing purposes} }
}
child { node {Futures}
child { node {Listed} }
child { node {Tradable} }
child { node {Main indices}
% child { node {SX5E} }
% child { node {SPX} }
% child { node {VIX} }
% child { node {Commos} }
}
}
}
child[branch color=green] { node {Swaps}
child { node {IRS}
child { node {Asset Swap} }
child { node {Fix vs floating} }
}
child { node {Fx}
child { node {CCS} }
}
child { node {CDS} node {Equity Swaps}
child { node {Reference assets} }
}
child { node {Equity Swaps}
child { node {All types of pay-off} }
}
}
child[branch color=blue] { node {Options}
child { node {Vanilles}
child { node {Short term} }
child { node {Listed} }
child { node {Calls} }
child { node {Put} }
child { node {Stratégies} }
}
child { node {Exotiques}
child { node {Long term} }
child { node {Asian} }
child { node {KIKO} }
child { node {Lookback} }
child { node {Ladder} }
}
}
child[branch color=pink, text=black] { node {Wrapping}
child { node {SPV}
}
child { node {Funds}
child { node {ETF} }
child { node {Structured funds} }
child { node {OPCVM} }
child { node {Hedge funds} }
}
child { node {Linked Note}
child { node {EMTN} }
child { node {BMTN} }
child { node {Certificates} }
}
}
child[branch color=orange] { node {Structur\'es}
child { node {Capital garanti}
child { node {ZC + call} }
}
child { node {Non garanti}
child { node {Reverse} }
}
child { node {Protégé}
child { node {Reverse airbag} }
}
child { node {Autocall}
child { node {Athéna} }
child { node {Phoenix} }
}
}
;
\end{scope}
\end{tikzpicture}
\end{document}
```