n>
    
    <span class="c1"># Calculate the true interactions</span>
    <span class="n">con</span> <span class="o">=</span> <span class="n">radius_neighbors_graph</span><span class="p">(</span><span class="n">adata</span><span class="o">.</span><span class="n">obsm</span><span class="p">[</span><span class="n">spatial_key</span><span class="p">],</span> <span class="n">niche_radius</span><span class="p">,</span>  <span class="n">mode</span><span class="o">=</span><span class="s1">&#39;connectivity&#39;</s