hk Module

A module containing a Fortran implementation of the Hoshen-Kopelman algorithm, as well as the necessary union-find procedures.


Used by

  • module~~hk~~UsedByGraph module~hk hk module~percolation percolation module~percolation->module~hk module~randomwalk randomwalk module~randomwalk->module~percolation

Contents


Functions

public function hoshen_kopelman(matrix) result(num_clusters)

Hoshen-Kopelman algorithm for labelling clusters on a binary matrix.

Read more…

Arguments

Type IntentOptional AttributesName
integer, intent(inout), dimension(:,:):: matrix

The matrix to be labelled.

Return Value integer

The total number of disjoint clusters labelled.

public function uf_find(x, labels) result(y)

Union-Find find algorithm: Find the lowest corresponding label. Relabelling is done when necessary.

Arguments

Type IntentOptional AttributesName
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.

Return Value integer

public function uf_union(x, y, labels) result(canonical_label)

Union-Find union algorithm: Merge two labels, return the result.

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: x

Labels to merge.

integer, intent(in) :: y

Labels to merge.

integer, intent(inout), dimension(:):: labels

List of labels.

Return Value integer