<P> In terms of type theory, a tree is an inductive type defined by the constructors nil (empty forest) and node (tree with root node with given value and children). </P> <P> Viewed as a whole, a tree data structure is an ordered tree, generally with values attached to each node . Concretely, it is (if required to be non-empty): </P> <Ul> <Li> A rooted tree with the "away from root" direction (a more narrow term is an "arborescence"), meaning: <Ul> <Li> A directed graph, </Li> <Li> whose underlying undirected graph is a tree (any two vertices are connected by exactly one simple path), </Li> <Li> with a distinguished root (one vertex is designated as the root), </Li> <Li> which determines the direction on the edges (arrows point away from the root; given an edge, the node that the edge points from is called the parent and the node that the edge points to is called the child), </Li> </Ul> </Li> </Ul> <Li> A rooted tree with the "away from root" direction (a more narrow term is an "arborescence"), meaning: <Ul> <Li> A directed graph, </Li> <Li> whose underlying undirected graph is a tree (any two vertices are connected by exactly one simple path), </Li> <Li> with a distinguished root (one vertex is designated as the root), </Li> <Li> which determines the direction on the edges (arrows point away from the root; given an edge, the node that the edge points from is called the parent and the node that the edge points to is called the child), </Li> </Ul> </Li>

Each position in the tree is called a node or vertex