[Xy-pic] binary trees

Ross Moore ross@ics.mq.edu.au
Thu, 21 Jun 2001 08:05:10 +1000 (EST)

Hi Andreas,

you wrote:
> Hello,
> I hope someone on this list can help me with drawing a bunch of binary trees.
> In fact, the ordinary tree is not a problem, but I'd like to use these
> "roof-like" triangle structures that represent entire subtrees. (Use case:
> B-Trees, AVL-Trees, etc.) I just don't know how to draw them.

\xygraph is the perfect tool for this.
Here is an example, based on what you ask for below:


The code is in:


The Xy-pic Reference Manual explains the parsing of the
argument of \xygraph. It provides a simple "escape" mechanism
to use arbitrary Xy-pic kernel code, when this is an appropriate
way to add features into the diagram.

Hope this helps.

        Ross Moore

> Consider this example: If I have a root node A and a right node B, then I
> want my left edge attached to a triangle structure, representing a whole
> subtree. How do I attach the graphics for this subtree to root node A?
>          A
>         / \
>        /   \
>       / \   B
>       ---
>       sub.
> I asked this on a newsgroup before, with no success. Also I Googled around,
> but with no luck either...
> I'd appreciate your hints and help. Thank you very much!
> Andreas Bauer.
> _______________________________________________
> Xy-pic mailing list