After the last iteration, we use these collected counts as weights and compute maximum directed spanning trees using the Chu-Liu/Edmonds' algorithm (Chu and Liu, 1965).
the resulting trees consist of edges maximizing the sum of individual counts: It is important to note that the MST algorithm may produce non-projective trees.