/span>
        <span class="n">UF</span> <span class="o">=</span> <span class="n">UnionFind</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">()))</span>



        <span class="c1"># Loop through the levels to add edges, and update teh distance matrix if </span>
        <span class="c1"># a pair of objects not already merged.</span>
        <span class="k">for</span> <span class="