A module containing a Fortran implementation of the Hoshen-Kopelman algorithm, as well as the necessary union-find procedures.
Hoshen-Kopelman algorithm for labelling clusters on a binary matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout), | dimension(:,:) | :: | matrix | The matrix to be labelled.  | 
  
The total number of disjoint clusters labelled.
Union-Find find algorithm: Find the lowest corresponding label. Relabelling is done when necessary.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | x | Label for which to find the lowest corresponding label.  | 
  
||
| integer, | intent(inout), | dimension(:) | :: | labels | List of labels. labels(i) points to the lowest corresponding label of label i.  | 
  
Union-Find union algorithm: Merge two labels, return the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | x | Labels to merge.  | 
  
||
| integer, | intent(in) | :: | y | Labels to merge.  | 
  
||
| integer, | intent(inout), | dimension(:) | :: | labels | List of labels.  |