site_percolation#

site_percolation(network, occupied_sites)[source]#

Assigns cluster numbers to sites and bonds acccording to a site percolation process, given a list of occupied sites.

Parameters:
  • conns (array_like) – An N x 2 array connections. If two connected sites are both occupied they are part of the same cluster, as is the bond connecting them.

  • occupied_sites (ndarray) – A boolean array with one element for each site, with True values indicating that a site is occupied

Returns:

  • A tuple containing a list of site and bond labels, indicating which

  • cluster each belongs to. A value of -1 indicates unoccupied.

Notes

The connected_components function of scipy.sparse.csgraph will give ALL sites a cluster number whether they are occupied or not, so this function essentially adjusts the cluster numbers to represent a percolation process.