span class="n">z_comb</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">z_array</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>

            <span class="c1"># Create neighbor indices of length z_comb with default as -1.</span>
            <span class="n">neighbors</span> <span class="o">=</span> <span class="n">np</span><span