corrected an error in the neighbor joining algorithm, that was present also in the julia code. Namely the fact that when introducing a new merged node $k$ its distance to a new node $u$ is given by $D[u,k] = (D[i,u] + D[j,u] - D[i,j])/2$. We had an error in the sign of the $D[i,j]$ term in the julia version.
corrected the postorder traversal. In postorder traversal no parental node should be visited before all of its children node are visited. Please double-check that what I did makes sense, I'm not super confident with generic functions...
added to_newick function for the Clade struct, that returns a newick string. This is done to facilitate tests, and also because we might want to output the tree that we build for logging/checks.
I extended tests for neighbor joining. Among others I added an example from wikipedia which should be a good reference.
I did the following changes:
to_newick
function for theClade
struct, that returns a newick string. This is done to facilitate tests, and also because we might want to output the tree that we build for logging/checks.