[Tex/LaTex] Drawing a tree where many nodes have the same child in TikZ

tikz-pgftikz-trees

I'm trying the draw a tree using the TikZ package, but I don't know how to draw a child node that has many parents. An example for that, is given by this picture
power set graph

My problem is how to draw the level 3.

Best Answer

You can use two trees sitting on top of each other.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=2.5cm]
\node (topnode) at (0,5) { {\{\{1\}\{2\}\}\{3\}\{4\}}\} } 
child { node {{\{\{1,2\}\{3\}\{4\}}\}} }
child { node {{\{\{1,3\}\{2\}\{4\}}\}} }
child { node {{\{\{1,4\}\{2\}\{3\}}\}} }
child { node {{\{\{2,3\}\{1\}\{4\}}\}} }
child { node {{\{\{2,4\}\{1\}\{3\}}\}} }
child { node {{\{\{3,4\}\{1\}\{2\}}\}} }
;

\node[minimum width=3cm](bottomnode) {\{\{1,2,3,4\}\}} [grow'=up]
child { node {{\{\{1,2,3\}\{4\}}\}} }
child { node {{\{\{1,2,4\}\{3\}}\}} }
child { node {{\{\{1,2\}\{3,4\}}\}} }
child { node {{\{\{1,3,4\}\{2\}}\}} }
child { node {{\{\{1,3\}\{2,4\}}\}} }
child { node {{\{\{1,4\}\{2,3\}}\}} }
child { node {{\{\{2,3,4\}\{1\}}\}} }
;
\foreach \x in {1,2,3}{
\draw (topnode-1) -- (bottomnode-\x);
}
\end{tikzpicture}
\end{document}

enter image description here

I'll leave the connection lines to you if you don't mind. You can access each node by first writing up the parent node name followed by a dash and the item number e.g. (topnode-5).

Related Question