3

I want to draw a structure as shown in the picture lattice

so that the knots 3 and 2 are on the top left and top right of 1. And 4 should be in the middle of 3 and 2 in the level on top of them and so on. I tried hard in the last few hours but the best result I got is:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
 \graph [grow up=10mm, branch right=10mm] {0--1--{3--4,2--{4,5}--6}};
\end{tikzpicture}
\end{document} 

with the output:

TeX-Output

Can anyone please help me? Thank you!

EDIT: I'm looking for code that doesn't use explicit coordinates because I have to draw a lot more (and bigger) structures.

2

By adding specific x-coordinates for the nodes 3 and 5 you get the desired result.

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
 \graph [grow up=10mm, branch right=10mm] {0--1--{3[x=-1]--4,2--{4,5[x=1]}--6}};
\end{tikzpicture}
\end{document}

enter image description here

2
  • Thank you! Is there a possibility to get this result without using coordinates? (\graph [more options here...] ) I have a lot of similar bigger graphs to draw...
    – user75624
    Apr 5 '15 at 7:07
  • @Chipsy Don't know, I'm afraid. I just browsed the manual until I found something that might work, I never draw these kinds of things myself. Apr 5 '15 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy