# Creating radial trees in TikZ

I am fairly new TikZ user and I am looking for a way to generate a radial tree similar this: or this: So far, I have two methods of doing this:

1) Program it manually - This involves quite a lot of setup and could be a very time consuming project even for my (relatively) small trees of only about dozen+ nodes.

2) Use the Mindmap library - This is the closest library I've found, but after a lot of reading up on the subject, it appears that it would require extensive modification to function as radial tree instead of a mindmap. The lines would have to be changed and the placement of nodes would have to be altered slightly.

Is there a good TikZ library or method for generating radial trees that A) use lines to connect nodes, and B) provide control over the distance of a node from the root i.e. all nodes of a given depth at the same distance from root vs staggering distance of nodes with too many siblings?

Criteria B is not mandatory, but is something that I am strongly hoping for: it would be nice to be able to modify placement of nodes based on number of siblings, but the essential thing is still the creation of the radial tree that doesn't look as silly as a mindmap and provides some control over the placement of nodes.

• The mindmap library only uses the tree library and its functions. There are keys like grow cyclic and grow clockwise/grow counterclockwise as well as sibling angle that help here. You can also use the level styles to set certain level distances. Take a look at the examples in the PGF manual, p. 476. Sep 26, 2013 at 13:57
• I am using neato from Graphviz (graphviz.org) to create these radial trees. The resulting pdfs are then included through pdflatex Sep 26, 2013 at 17:58

One possibilty:

\documentclass[png,tikz,border=10pt]{standalone}
\usepackage{tikz}

% style definitions
\tikzset{level 1/.style={sibling angle=60,level distance=25mm}}
\tikzset{level 2/.style={sibling angle=35,level distance=18mm}}
\tikzset{level 3/.style={sibling angle=20,level distance=12mm}}
\tikzset{edge from parent/.style={segment angle=10,draw}}

\begin{document}

\begin{tikzpicture}
[grow cyclic,shape=circle,cap=round,scale=0.5]
\node[draw,top color=blue!10,bottom color=blue,minimum size=12pt] {}
child  foreach \A in {red,red,red,red,red,red}{
node[draw,top color=\A!10,bottom color=\A,minimum size=8pt] {}
child foreach \B in {green,green,green}{
node[draw,top color=\B!10,bottom color=\B,minimum size=6pt] {}
child foreach \C in {magenta,magenta,magenta}{
node[draw,top color=\C!10,bottom color=\C,minimum size=4pt] {} }
}
};
\end{tikzpicture}

\end{document}


The result: • Not sure whether it accomplish all the requirements though. Sep 26, 2013 at 14:07
• That is absolutely beautiful. How can I add the nodes individually??? Apr 16, 2021 at 17:01
• @Andrea: Thanks! Though question, it has two meanings. 1) Actually for complete individual addition, you should follow a radically different approach than this, which creates a radial tree programatically: go by defining one by one the nodes assigin the position through math expressions. 2) If you want to add one or two nodes to the radial tree created in such a way, you should give names to each of the nodes (say n-<x> and then you create an additional node positioned with respect to a certain n-<i>. Hope it helps Apr 16, 2021 at 17:28