bond_percolation#
- bond_percolation(network, occupied_bonds)[source]#
Assigns cluster numbers to sites and bonds acccording to a bond percolation process, given a list of occupied bonds.
- Parameters:
conns (array_like) – An N x 2 array connections. Any sites connected to an occupied bond will also be considered occupied and given the same cluster number as the bond.
occupied_bonds (ndarray) – A boolean array with one element for each bond, with
True
values indicating that a bond is occupied
- Returns:
A tuple containing a list of site and bond labels, indicating which
cluster each belongs to. A value of -1 indicates uninvaded.
Notes
The
connected_components
function ofscipy.sparse.csgraph
will give a cluster number to ALL bonds whether they are occupied or not, so this function essentially adjusts the cluster numbers to represent a percolation process.