[pstricks] Re: Trees

Herbert Voss Herbert.Voss at gmx.net
Sat Jul 3 14:25:30 CEST 2004


David Rasmussen wrote:
> I am trying to draw game trees with the pst-tree package. So far I have 
> managed to draw some simple game trees. But I would like to show how the 
> tree is traversed with arrows following the arcs in a certain order. 
> Very much like this:
> 
> http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic11/alpha33.jpg

[...]

> If I would like to show traversing with arrows, how do I do that?

use psmatrix for this kind of tree.

Herbert

\documentclass[a4paper,12pt]{report}
\usepackage{pstricks,pst-node,pst-grad}

\begin{document}

\psset{fillstyle=gradient,gradbegin=cyan,gradend=white}
\begin{psmatrix}[colsep=0.75cm]
& & & & & [name=a]\psframebox{\textcolor{red}{\textbf{7}}} \\
& [name=b]\pscirclebox{7} & & & & [name=c]\pscirclebox{4} & & & & 
[name=d]\pscirclebox{1}\\[0pt]
[name=e]\psframebox{9} & [name=f]\psframebox{8} & [name=g]\psframebox{7} & &
\end{psmatrix}
\ncline[linecolor=cyan,linewidth=2pt]{a}{b}
\ncline[linecolor=magenta,offset=2mm,arrows=<-]{a}{b}
\ncline[linecolor=magenta,offset=-2mm,arrows=->]{a}{b}
%
\ncline[linewidth=2pt]{b}{e}
\ncline[linecolor=magenta,offset=2mm,arrows=<-]{b}{e}
\ncline[linecolor=magenta,offset=-2mm,arrows=->]{b}{e}
\end{document}



-- 
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes




More information about the PSTricks mailing list