# rQuartetI: Calculation of the rooted quartet index for rooted trees In treebalance: Computation of Tree (Im)Balance Indices

## Description

This function calculates the rooted quartet index rQI(T) for a given rooted tree T. The tree must not necessarily be binary.

Let T be a rooted tree, whose leaves are 1,...,n. Let P_4 denote the set of all subsets of \{1,...,n\} that have cardinality 4. Let T(Q) denote the rooted quartet on Q\in P_4 that is obtained by taking the subgraph of T that is induced by Q and supressing its outdegree-1 vertices. T(Q) can have one of the five following shapes:

- Q_0^*: This is the caterpillar tree shape on 4 leaves, i.e. "(,(,(,)));" in Newick format. It has 2 automorphisms.
- Q_1^*: This is the tree shape on 4 leaves that has three pending subtrees rooted at the children of the root of T, one of them being a cherry and the other two being single vertices, i.e. "((,),,);" in Newick format. It has 4 automorphisms.
- Q_2^*: This is the tree shape on 4 leaves that has two pending subtrees rooted at the children of the root of T, one of them being a star tree shape on 3 leaves and the other one being a single vertex, i.e. "((,,),);" in Newick format. It has 6 automorphisms.
- Q_3^*: This is the fully balanced binary tree shape on 4 leaves, i.e. "((,),(,));" in Newick format. Its has 8 automorphisms.
- Q_4^*: This is the star tree shape on 4 leaves, i.e. "(,,,);" in Newick format. It has 24 automorphisms.

T(Q) is assigned an rQI-value based on its shape, i.e. rQI(T(Q))=q_i if T(Q) has the shape Q_i^*. The values q_0,...,q_4 are chosen in such a way that they increase with the symmetry of the shape as measured by means of its number of automorphisms. Coronado et al. (2019) suggested the values q_0=0 and q_i=i or q_i=2^i for i=1,...,4.
The rooted quartet index rQI(T) of the tree T is then defined as the sum of the rQI-values of its rooted quartets:

rQI(T)=∑ rQI(T(Q)) over Q in P_4

The rooted quartet index is a balance index.

## Usage

 1 rQuartetI(tree, shapeVal = c(0, 1, 2, 3, 4)) 

## Arguments

 tree A rooted tree in phylo format. shapeVal A vector of length 5 containing the shape values q_0,...,q_4. Default is (q_0,q_1,q_2,q_3,q_4)=(0,1,2,3,4).

## Value

rQuartetI returns the rooted quartet index of the given tree based on the chosen shape values (see description for details).

Sophie Kersting

## References

T. M. Coronado, A. Mir, F. Rosselló, and G. Valiente. A balance index for phylogenetic trees based on rooted quartets. Journal of Mathematical Biology, 79(3):1105-1148, 2019. doi: 10.1007/s00285-019-01377-w. URL https://doi.org/10.1007/s00285-019-01377-w.

## Examples

 1 2 tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));") rQuartetI(tree) 

treebalance documentation built on Oct. 17, 2021, 5:06 p.m.