Skip to main content
. 2023 Sep 15;25(9):1342. doi: 10.3390/e25091342
Algorithm 2: Pseudocode for low-dimensional clustering based on adjacent grid searching.
                      Input: dataset Dd, noise cells NC, peripheral cells PC, core cells CC
                      Output: cluster label, cluster density, cluster number m
1: Initialization;
2: Find the adjacent cells for each nonnull cell in CC according to Equation (12);
3: Rank all cells in descending order of density;
4: CM cells number of CC, m0;
5: For i = 1 to CM Do
6:    If the ith cell in CC is not handled, Then
7:       m m +1, tempClusterthe ith cell in CC, j 1;
8:       While not all cells in tempCluster are handled, Do
9:          Label the jth cell in tempCluster to be the mth cluster;
10:        Add the adjacent cells in CC of the jth cell to tempCluster;
11:        j j + 1;
12:    end While
13: end If
14: end For
15: PM cells number of PC;
16: While not all cells in PC are handled, Do
17: For i = 1 to PM Do
18:    If the ith cell in PC is not handled, Then
19:      Find its adjacent cells according to Equation (12);
20:      Select the above adjacent cells which are in CC;
21:      Calculate the distance between the cell and its adjacent cells in CC according to
                Equation (15);
22:      Label the ith cell in PC to be the same cluster with its nearest adjacent cell in CC;
23:    end If
24: end For
25: end While
26: Label the data points according to their cells;
27: Calculate the mean density of the cells of each cluster;