1

I'd like to use TikZ to typeset some graphs like this one:

graph with interesting vertices

(Sorry for the crappy camera-phone pic)

I am familiar with \node, \path and edge, as well as with getting different arrowhead styles.

The bit that's tripping me up is getting the vertices of the graph to be these little triangular number diagrams. This one is relatively simple (the number diagrams are only 2x2), but I have others where the diagrams are 3x3 and bigger.

Would it be best to use an array environment inside each \node? Is that even possible?

Or is there a better way? Thanks!

1
  • It is certainly possible to use array in a node. That sounds like a good idea for this graph. If you try this and have trouble, I suggest posting a MWE. Nov 10, 2013 at 17:55

1 Answer 1

8

The new graph drawing library in the CVS version of pgf can do this quite nicely. Exploiting the align key, and setting it to right means the node contents in this specific case can be given quite simply.

However, it does needs luatex to compile.

\documentclass[border=0.125cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{layered}

\begin{document}

\begin{tikzpicture}[>=stealth, every node/.style={align=right}]

\graph [layered layout,grow=up, level distance=0.5in, sibling distance=0.5in]
    {
        "00\\0" -> "01\\0" -> {"01\\1", "11\\0"} -> "11\\1"
    };

\end{tikzpicture}

\end{document}

enter image description here

1
  • That's neat, and impressive. I may look into updating my system to try and use these new features. I appreciate your time.
    – Harold
    Nov 10, 2013 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .