You could do a recursive tree traversal and render the nodes step by step. This means also that your data has to be linked or you will be searching childs over and over in your dataset which is inperformant if the amount of nodes increases.

I've written a tree traversal which i used for process several tree structures in order to render the (in our case from bottom up - but traversal can be used in both sides). Unfortunately it's written in c# and i'm not in Office right now so i can't post the renderer. If you're interested i can outline the principal the renderer works.


I guess what you need is to draw a general graph (not tree structure), but don't know how to layout the nodes and edges so that they don't look like a total mess.

There are some graph layout algorithms out there. The basic idea is to treat the nodes as objects that repel each other (like in physics), so that the graph is expanded to the largest extent possbile.

I found this SO question relevant: Graph auto-layout algorithm

And if you want to dig deeper, here is some research papers on the subject:

Hope this helps!

Related Query

More Query from same tag