code: def _bond_percolation(network, tmask):
      r
      # Perform the clustering using scipy.csgraph
      csr = network.create_adjacency_matrix(weights=tmask, fmt='csr',
                                            drop_zeros=True)
      clusters = sprs.csgraph.connected_components(csgraph=csr,
                                                   directed=False)[1]
  
      # Convert clusters to a more usable output:
      # Find pores attached to each invaded throats
      Ps = network.find_connected_pores(throats=tmask, flatten=True)
      # Adjust cluster numbers such that non-invaded pores are labelled -1
      p_clusters = (clusters + 1)*(network.tomask(pores=Ps).astype(int)) - 1
      # Label invaded throats with their neighboring pore's label
      t_clusters = clusters[network['throat.conns']][:, 0]
      # Label non-invaded throats with -1
      t_clusters[~tmask] = -1
  
      return (p_clusters, t_clusters)
docs: r"""
      This private method is called by 'find_clusters'