Given an additive matrix $$D$$ and a leaf $$j$$, LimbLength($$j$$) is equal to the minimum value of \[ \frac{D_{i, j} + D_{j, k} - D_{i, k}}{2} \] over all leaves $$i$$ and $$k$$.
Add a method limb_length to the class DistanceMatrix that takes the index $$i$$ of a row/column in the distance matrix and returns LimbLength($$i$$).
In the following example we assume the text file distances.txt1 to be located in the current directory.
>>> D = DistanceMatrix.loadtxt('distances.txt') >>> float(D.limb_length(0)) 11.0 >>> float(D.limb_length(1)) 2.0 >>> float(D.limb_length(2)) 6.0 >>> float(D.limb_length(3)) 7.0