Skip to main content
. 2023 May 12;24(3):bbad174. doi: 10.1093/bib/bbad174

Algorithm 1.

McAN

Input:
   Inline graphic, the number of haplotypes,   Inline graphic, the set of mutations in haplotype Inline graphic,   Inline graphic, the sampling time of haplotype Inline graphic,   Inline graphic, the number of samples in haplotype Inline graphic.
Output:
   Inline graphic, the minimum-cost arborescence, which is a set of edges.
Step 1 (sort all haplotypes by generating a permutation Inline graphic)    Inline graphic
Step 2 (find minimum-cost arborescence Inline graphic)   Inline graphic    for each Inline graphic from 0 to Inline graphic,     for each Inline graphic from Inline graphic to Inline graphic,      if Inline graphic, then       if Inline graphic, then       Inline graphic
       break,
   end if, end if, end for, end for,   return Inline graphic.