compute distance between two lineages