Home > documentation, graph theory, LaTeX > Typeset trees using TikZ/PGF

Typeset trees using TikZ/PGF

Some combinatorial trees typeset using TikZ/PGF. The Linux filesystem hierarchy:

The Linux filesystem hierarchy.

\begin{tikzpicture}
[-,thick]
\footnotesize
\node {\texttt{/}} [edge from parent fork down]
  child {node {\texttt{bin}}}
  child {node {\texttt{etc}}}
  child {node {\texttt{home}}
    child {node {\texttt{anne}}}
    child {node {\texttt{sam}}}
    child {node {$\dots$}}
  }
  child {node {\texttt{lib}}}
  child {node {\texttt{opt}}}
  child {node {\texttt{proc}}}
  child {node {\texttt{tmp}}}
  child {node {\texttt{usr}}
    child {node {\texttt{bin}}
      child {node {\texttt{acyclic}}}
      child {node {\texttt{diff}}}
      child {node {\texttt{dot}}}
      child {node {\texttt{gc}}}
      child {node {\texttt{neato}}}
      child {node {$\dots$}}
    }
    child {node {\texttt{include}}}
    child {node {\texttt{local}}}
    child {node {\texttt{share}}}
    child {node {\texttt{src}}}
    child {node {$\dots$}}
  }
  child {node {$\dots$}};
\end{tikzpicture}

Classification tree of organisms:
Classification tree of organisms.

\begin{tikzpicture}
[sibling distance=6cm,-,thick]
\footnotesize
\node {organism}
  child {node {plant}
    [sibling distance=2cm]
    child {node {tree}
      child {node {deciduous}}
      child {node {evergreen}}
    }
    child {node {flower}}
  }
  child {node {animal}
    [sibling distance=2.5cm]
    child {node {invertebrate}}
    child {node {vetebrate}
      [sibling distance=4.7cm]
      child {node {bird}
        [sibling distance=1.5cm]
        child {node {finch}}
        child {node {rosella}}
        child {node {sparrow}}
      }
      child {node {mammal}
        [sibling distance=1.5cm]
        child {node {dolphin}}
        child {node {human}}
        child {node {whale}}
      }
    }
  };
\end{tikzpicture}

The Bernoulli family tree of mathematicians:
Bernoulli family tree of mathematicians.

\begin{tikzpicture}
[-,thick,%
  every node/.style={shape=rectangle,inner sep=3pt,draw,thick}]
\footnotesize
\node {Nikolaus senior} [edge from parent fork down]
  [sibling distance=4cm]
  child {node {Jacob}}
  child {node {Nicolaus}
    child {node {Nicolaus I}}
  }
  child {node {Johann}
    [sibling distance=2cm]
    child {node {Nicolaus II}}
    child {node {Daniel}}
    child {node {Johann II}
      child {node {Johann III}}
      child {node {Daniel II}}
      child {node {Jakob II}}
    }
  };
\end{tikzpicture}

An expression tree:

Expression tree for the perfect square identity.

\begin{tikzpicture}
[-,thick]
\node {$+$}
  [sibling distance=2.5cm]
  child {node {$\times$}
    [sibling distance=1cm]
    child {node {$a$}}
    child {node {$a$}}
  }
  child {node {$\times$}
    [sibling distance=1cm]
    child {node {$2$}}
    child {node {$a$}}
    child {node {$b$}}
  }
  child {node {$\times$}
    [sibling distance=1cm]
    child {node {$b$}}
    child {node {$b$}}
  };
\end{tikzpicture}
About these ads
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: