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. Tress can be used, e.g., for representing the result in syntax parsing. Every [XML] document has a tree structure. [Tcllib] contains a tree data structure. Documentation for it can be found at http://tcllib.sourceforge.net/doc/tree.html . This module of the [tcllib] data [struct]ures collection provides the data structure portion of a tree structure. The tcllib Tree would be more useful if nodes could be arbitrary objects (specifically, if they could be [incr Tcl] objects). To that end, I made some mods which [string map] {:: @} in the creation of [namespace] data arrays. Worth adding to the mainline? [CMCc] ---- [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.... ---- Also, [BWidget] has a [Tree] widget. (See [Tree nodes in motion] - [starDom] - [LemonTree]). ---- For a lightweight approach, see [Trees as nested lists]. ---- Related topics: * [Containers] tree container command * [ODIE] environment which has tools for data tree maintenance * [RBTree] red-black tree data type * [Tree Objects] discussed by [Clif Flynt] * [Various useful Tcl packages (Rempel)] includes some tree operation packages * graphical representation of tree data * a "tree widget", often for filesystem data, which appears in particular the [TkTreeCtrl] widget, tree widgets from the [Hipp miscellaneous widgets], [mtree widget], as well as the [BWidget], [BLT], [Tix], [ClassyTk], [incr widgets]' hierarchy widget, [mkWidgets], [PRS Open Source Software], [Zinc] packages, and the pure-[Python] TreeWidget [http://oomadness.tuxfamily.org/p-treewidget.php] for [Tkinter]. Among these, treectrl is complex for beginners, while the more accessible BWidget one ''does'' have edit capabilities. * [Tk Tree Widget in C++], [tkgcv], [hierarchy], [Tree Table], born2net's [Iwidgets] version of Hipp's tree widget, Brighton's Iwidgets tree widget, Mutlu's Iwidgets version of a tree widget, Pryce's itk widget base class are some older examples of tree widget implementations * Also check out [tktree] for a tcl/tk tree widget * [GRIDPLUS] has a basic scrollable tree widget ---- [[ [Arts and Crafts of Tcl-Tk Programming] | [Category Command], package [tcllib], module [struct] | [Category Data Structure] | ]]