n class="c1"># Convert to directed graph eminating from the root</span>
                <span class="c1"># Because of the ReebGraph convention, edges point up to higher function values.</span>
                <span class="n">T</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">bfs_tree</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="n">source</span> <span class="o">=</span> <span class="n">root</span><span class="p">)</