Question

The system I'm currently working on involves the creation of binary decision trees. Lots of them. Some of them are stored in XML format so they can be analyzed manually if needed.

The tree structure is basically nested <NODE> tags. Each node may also have a few child tags defining the properties of the node.

What I would like to do is display the trees graphically. Vertically or horizontally does not matter but I would like to use a geometrically tree-shaped layout e.g. like this:

alt text

...rather than the layout commonly used in file system browsers, which isn't the best way to display binary trees.

Is there a .NET based library or, alternatively, a stand-alone tool which does this well?

Was it helpful?

Solution

Have you looked at Graphviz ? There are some language bindings for .Net (see resources), and it can output in a variety of formats (so you can view using SVG/HTML/Flex, standalone viewers etc.)

OTHER TIPS

graphViz

The selected answer also recommends graphviz but doesn't provide an rendered example; what's more the comments below that answer mention that graphviz is not easy to use for the purpose recited in the question.

i disagree. I actually use graphviz for this purpose--as a library (via python bindings supplied by pygraphviz) for plotting the output (i.e., the structure created by running the C4.5 algorithm against a training set). Setting the graph type as a directed graph (digraph is the formal syntax), graphviz' SMACOF algorithm gives you a nice tree structure right out of the box.

For instance:

alt text http://img205.imageshack.us/img205/9290/btreeingraphviz.png

To create the graph below, i kept the default values for all of the 'graph' parameters that affect layout (e.g., nodesep, ranksep, ratio), with the exception of 'orientation', which i set to 'landscape' (default is 'portraint').

I stumbled upon a WPF based package on CodeProject:

A Graph Tree Drawing Control for WPF

Looks simplistic enough and should cover my needs. Any comments on this?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top