Reference articles on history, science, culture and more
Encyclopedia

Unrooted binary tree

Image credit is listed at the end of this article.

In mathematics and computer science, an unrooted binary tree is an unrooted tree in which each vertex has either one or three neighbors.

01Definitions

A free tree or unrooted tree is a connected undirected graph with no cycles. The vertices with one neighbor are the leaves of the tree, and the remaining vertices are the internal nodes of the tree. The degree of a vertex is its number of neighbors; in a tree with more than one node, the leaves are the vertices of degree one. An unrooted binary tree is a free tree in which all internal nodes have degree exactly three.

In some applications it may make sense to distinguish subtypes of unrooted binary trees: a planar embedding of the tree may be fixed by specifying a cyclic ordering for the edges at each vertex, making it into a plane tree. In computer science, binary trees are often rooted and ordered when they are used as data structures, but in the applications of unrooted binary trees in hierarchical clustering and evolutionary tree reconstruction, unordered trees are more common.

Additionally, one may distinguish between trees in which all vertices have distinct labels, trees in which the leaves only are labeled, and trees in which the nodes are not labeled. In an unrooted binary tree with n leaves, there will be n  2 internal nodes, so the labels may be taken from the set of integers from 1 to 2n  1 when all nodes are to be labeled, or from the set of integers from 1 to n when only the leaves are to be labeled.

An example of an unrooted binary tree with four leaves
An example of an unrooted binary tree with four leaves

03Enumeration

Because of their applications in hierarchical clustering, the most natural graph enumeration problem on unrooted binary trees is to count the number of trees with n labeled leaves and unlabeled internal nodes. An unrooted binary tree on n labeled leaves can be formed by connecting the nth leaf to a new node in the middle of any of the edges of an unrooted binary tree on n  1 labeled leaves. There are 2n  5 edges at which the nth node can be attached; therefore, the number of trees on n leaves is larger than the number of trees on n  1 leaves by a factor of 2n  5. Thus, the number of trees on n labeled leaves is the double factorial

(2n-5)!!={\frac {(2n-4)!}{(n-2)!2^{n-2}}}.

The numbers of trees on 2, 3, 4, 5, ... labeled leaves are

1, 1, 3, 15, 105, 945, 10395, 135135, 2027025, 34459425, ... (sequence A001147 in the OEIS).

04Fundamental Equalities

The leaf-to-leaf path-length on a fixed Unrooted Binary Tree (UBT) T encodes the number of edges belonging to the unique path in T connecting a given leaf to another leaf. For example, by referring to the UBT shown in the image on the right, the path-length p_{1,2} between the leaves 1 and 2 is equal to 2 whereas the path-length p_{1,3} between the leaves 1 and 3 is equal to 3. The path-length sequence from a given leaf on a fixed UBT T encodes the lengths of the paths from the given leaf to all the remaining ones. For example, by referring to the UBT shown in the image on the right, the path-length sequence from the leaf 1 is p_{1}=(p_{1,2},p_{1,3},p_{1,4})=(2,3,3). The set of path-length sequences associated to the leaves of T is usually referred to as the path-length sequence collection of T .

Daniele Catanzaro, Raffaele Pesenti and Laurence Wolsey showed that the path-length sequence collection encoding a given UBT with n leaves must satisfy specific equalities, namely

  • p_{i,i}=0 for all i\in [1,n]
  • p_{i,j}=p_{j,i} for all i,j\in [1,n]:i\neq j
  • p_{i,j}\leq p_{i,k}+p_{k,j} for all i,j,k\in [1,n]:i\neq j\neq k
  • \sum _{j=1}^{n}1/2^{p_{i,j}}=1/2 for all i\in [1,n] (which is an adaptation of the Kraft-McMillan inequality)
  • \sum _{i=1}^{n}\sum _{j=1}^{n}p_{i,j}/2^{p_{i,j}}=2n-3, also referred to as the phylogenetic manifold.

These equalities are proved to be necessary and independent for a path-length collection to encode an UBT with n leaves. It is currently unknown whether they are also sufficient.

05Alternative names

Unrooted binary trees have also been called free binary trees, cubic trees, ternary trees and unrooted ternary trees. However, the "free binary tree" name has also been applied to unrooted trees that may have degree-two nodes and to rooted binary trees with unordered children, and the "ternary tree" name is more frequently used to mean a rooted tree with three children per node.

Watch videos about Unrooted binary treeExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Unrooted binary tree, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Images, from Wikimedia Commons:

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.