We propose a new cluster labelling algorithm as a tool for computer-aided simulation in the field of percolation theory. Due to the use of recursivity, the basic labelling algorithm only needs a few lines of code, and performs at least as well as the Hoshen-Kopelman algorithm with the small lattices that can be stored in the computer memory. Additionally, it can be extended to label the clusters, compute cluster parameters and check for percolation in a single pass over the lattice. We also detail how to deal with lattice dimensions higher than two or with lattices without complete connectivity. Huge lattices, which cannot be stored as a whole in the computer's memory, require a slight modification that permits the labelling by sublattices. In this case, a cluster association technique similar to that proposed by Hoshen and Kopelman is necessary. Nevertheless, the proposed algorithm is capable of labelling lattices of virtually any size, no matter what the memory capacity of the machine, because it does not require an entire line or hyperplane of the whole lattice to be in memory. It is only limited by the storage capacity of the devices attached to the machine. If what is needed is just percolation checking, the storage requirements are very low and processing times decrease, using the `percolation finders' suggested. Listings of C programs are available in the online edition.
[1]
J. Hoshen,et al.
Percolation and cluster structure parameters: The enhanced Hoshen-Kopelman algorithm
,
1997
.
[2]
William H. Press,et al.
Numerical Recipes in C, 2nd Edition
,
1992
.
[3]
Raoul Kopelman,et al.
Percolation and cluster distribution. I. Cluster multiple labeling technique and critical concentration algorithm
,
1976
.
[4]
D. Rapaport.
Monte Carlo experiments on percolation: the influence of boundary conditions
,
1985
.
[5]
Peter Reynolds,et al.
Large-cell Monte Carlo renormalization group for percolation
,
1980
.