sackinI: Calculation of the Sackin index for rooted trees
Description
This function calculates the Sackin index \(S(T)\) for a given rooted
tree \(T\). The tree must not necessarily be binary. \(S(T)\) is defined as
$$S(T)=\sum_{x\in V_L(T)} \delta(x)=\sum_{u\in V_{in}(T)} n_u$$ in
which \(V_L(T)\) denotes the leaf set of \(T\), \(\delta(x)\)
denotes the depth of the leaf \(x\), \(V_{in}(T)\) denotes the set of
inner vertices in \(T\), and \(n_u\) denotes the number of leaves
in the pending subtree that is rooted at \(u\). The Sackin index is an
imbalance index.
For \(n=1\) the function returns \(S(T)=0\) and a warning.
For details on the Sackin index, see
also Chapter 5 in "Tree balance indices: a comprehensive survey" (https://doi.org/10.1007/978-3-031-39800-1_5).
Usage
sackinI(tree)
Value
sackinI returns the Sackin index of the given tree.