TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
By definition this is not a tree, but a (more general) graph. – Caramdir Jun 8 '12 at 22:51
up vote 13 down vote accepted

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

\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);

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).

share|improve this answer
Very beautiful answer... New exercise: how to generalize the construction of this graph if initial set contains n elements? ;-) – Paul Gaborit Jun 9 '12 at 0:05
@PolGab I did it already... axiomatically :P – percusse Jun 9 '12 at 0:45

protected by Martin Scharrer Jun 9 '12 at 13:43

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.