== Hoshen–Kopelman algorithm for cluster finding ==
In this algorithm, we scan through a grid looking for occupied cells and labeling them with cluster labels. The scanning process is called a [[Raster scan|raster scan]]. The algorithm begins with scanning the grid cell by cell and checkchecking ifwhether the cell is occupied or not. If the cell is occupied, then it must be labeled with a cluster label. This cluster label is decidedassigned based on the neighbors of that cell. (For this we are going to use [[Union-find algorithm|Union-Find Algorithm]] which is explained in the next section.) If the cell doesn’t have any occupied neighbors, then, a new label is assigned to the cell.<ref name=":0" />