A tree is an acyclic directed-graph data structure where one node (the root) has no predecessor, and all other nodes have exactly one predecessor. Trees can be used, e.g., for representing the result in syntax parsing. An XML document is structured as a tree.

See Also

Data Format
Includes a list of formats for tree-like data.
Decision Trees
deep list
A standard Tcl list in which each single value is encoded as a list containing only one item, and each sequence of values is a list containing more than one item. This makes it possible to differentiate e.g., the single value one two three from a list containing the values one, two, and three.
What's wrong with the tree widgets?
Best Tree Widget , comp.lang.tcl, 2009-03-11
A discussion between Martyn, Ruediger, and Alexander

Types of Trees

red-black tree data type


Tcllib struct tree
Containers, by Iain B. Findleton
Includes tools for data tree maintenance
An implementatio of the DOM.
Tree Objects
discussed by Clif Flynt
Various useful Tcl packages (Rempel)
Includes some tree operation packages
A Tree class using TclOO, by Tom Krehbiel
An experimental tree structure, by Marco Maggi
Simple tree structure, by rui
ycl list deep, by PYK
An implementation of a deep list.


A tree widget. More accessible for beginners. Featurs edit capabilities.
A multicolumn, hierarchical listbox widget. Complex for beginners.
Hipp miscellaneous widgets
Includes some tree widgets.
mtree widget
incr widgets
Includes a hierarchy widget
PRS Open Source Software
A pure-Python tree widget for Tkinter
Tk Tree Widget in C++
Tree Table
born2net's Iwidgets version of Hipp's tree widget
Tree Widget, by Brighton
An Iwidgets tree widget.
Tree widget, by Mutlu: An Iwidgets version tree widget
Pryce's itk widget base class
Includes a basic scrollable tree widget
A Minimal Tree Widget


A little RSS browser
A little XML browser, by RS
Tree nodes in motion
Move nodes on a Bwidget tree.
Trees as nested lists
An exploration of both structural approaches for trees, along with some simple graphical interfaces.
Displaying Tree Hierarchy with Incremental Node Numbering


Simple tree layout, by Richard Suchenwirth
How to display a tree structure on a canvas.


Pythagoras Tree


AMG: A tree is sometimes called a DAG because it is a directed acyclic graph. I find this to be a useful mnemonic.

NEM: Well, all trees are DAGs, but not all DAGs are trees.

AMG: Yes, quite right; see the other tree properties listed in the first line of this page.

LV In the following text, I notice a number of cases where GUI widget sets have some sort of tree widget. In each of these cases, is the data structure intermingled with the data representation? Seems a shame that someone doesn't just build a graphically viewable widget that depends on a data structure that is separate. That way, someone could do work with one piece of code, and then, in other pieces, display that data. Seems like a natural method of developing and maintaining code....