span><span class="o">.</span><span class="n">reverse</span><span class="p">()</span>
        <span class="k">else</span><span class="p">:</span> <span class="c1"># T is already directed</span>
            <span class="c1"># Make sure that this thing will be valid, </span>
            <span class="c1"># I think this is the same as &quot;arboresence&quot; in networkx</span>
            <span class="c1"># which is true if maximum in-degree equal to 1. </span>
            <span class="c1"># Since our graphs poi