Sept. 8, 2015, 2:38 a.m. by Rosalind Team
The pseudocode below summarizes the neighbor-joining algorithm.
Construct the tree resulting from applying the neighbor-joining algorithm to a distance matrix.
Given: An integer n, followed by a space-separated n x n distance matrix.
Return: An adjacency list for the tree resulting from applying the neighbor-joining algorithm. Edge-weights should be accurate to two decimal places (they are provided to three decimal places in the sample output below).
Note on formatting: The adjacency list must have consecutive integer node labels starting from 0. The n leaves must be labeled 0, 1, ..., n-1 in order of their appearance in the distance matrix. Labels for internal nodes may be labeled in any order but must start from n and increase consecutively.
4 0 23 27 20 23 0 30 28 27 30 0 30 20 28 30 0
0->4:8.000 1->5:13.500 2->5:16.500 3->4:12.000 4->5:2.000 4->0:8.000 4->3:12.000 5->1:13.500 5->2:16.500 5->4:2.000