[Tex/LaTex] Creating radial trees in TikZ

tikz-treestrees

I am fairly new TikZ user and I am looking for a way to generate a radial tree similar this:

enter image description here

or this:

enter image description here

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.

Best Answer

One possibilty:

\documentclass[png,tikz,border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{trees,decorations,shadows}

% 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{every node/.style={inner sep=0pt,circular drop shadow}}
\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:

enter image description here

Related Question