"o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="s1">&#39;v_inf&#39;</span><span class="p">)</span>


        <span class="c1"># Check that the function is valid </span>
        <span class="k">if</span> <span class="n">f</span> <span class="o">==</span> <span class="p">{}:</span>
            <span class="c1"># Define a function with distance from the root (but reversed). Rigged so the minimum is always at 0. </span>
        