represents a tree with a list of child subtrees subtreei.
represents a tree containing data in its root, with children given by subtrees.
- Tree objects represent rooted, ordered, labeled trees. Standard examples include XML trees, file systems and Wolfram Language expressions.
- In Tree[data,subtrees], the subtrees are other Tree expressions or general expressions that are interpreted as leaves.
- Tree[…] displays in a notebook as a plot of a tree graph:
- Tree[…] is always converted to a standard form with structure Tree[data,subtrees].
- Tree[subtrees] is equivalent to Tree[Null,subtrees].
- Tree is treated as a raw object by functions like AtomQ.
- Options affecting individual tree elements or nodes include:
TreeElementLabel labels for subtree elements TreeElementStyle styles for subtree elements
- Options affecting the entire tree include:
TreeLayout how to lay out subtrees and edges
- Tree has all options shared by Graph and Graphics.
Examplesopen allclose all
Basic Examples (4)
Styling Individual Tree Elements (2)
Styling Entire Tree (4)
Tree Layout and Graphics Options (3)
Specify Graphics options:
Define a function that extracts the tag from an XMLElement:
Define a function that yields the child elements of an XMLElement:
Convert an XMLElement object to a tree:
Convert an XML tree to an XMLElement:
Define a function that converts a TextElement object to a tree:
Define a function that yields the child elements of a TextElement:
Convert TextElement to a tree:
Convert a text tree to a TextElement:
Properties & Relations (6)
This is not a valid Tree object:
Wolfram Research (2021), Tree, Wolfram Language function, https://reference.wolfram.com/language/ref/Tree.html (updated 13).
Wolfram Language. 2021. "Tree." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 13. https://reference.wolfram.com/language/ref/Tree.html.
Wolfram Language. (2021). Tree. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Tree.html