# DELER: Distributed Clustering with Local Direction Centrality and Density Measure
## 3 The DEALER Algorithm
### Data Partitioning
#### 3.3.2 Data Partition Adjustment
\(p_{j}\) is unlabeled and its distance to \(p_{i}\) is smaller than the distance between \(p_{i}\) and the nearest boundary point. 8:\(\mathcal{R}\leftarrow\mathcal{R}\backslash C_{m}\)
9:endwhile
```
**Algorithm 3** Local cluster expansion

Next, the clustering task for boundary points must be completed. Once the initial clusters are established, both the number and shape of the clusters are essentially determined. The clustering of boundary points becomes straightforward: since boundary points are located on the periphery of clusters, they can simply be assigned the same label as the nearest internal point. Specifically, boundary points are stored in a set \(B\). A boundary point is randomly selected, and its KNN points are examined to identify the closest internal point. The boundary point is then assigned the same label as the identified internal point, and the point is removed from \(B\). If all KNN points of the selected boundary point are also boundary points, the nearest boundary point is located, and the same cluster label is applied. If the nearest boundary point itself lacks a cluster label, the nearest boundary point of that point is identified, and the process repeats until all points in \(B\) have been labeled. Through these steps, all data points in dataset \(P\) are assigned cluster labels, marking the completion of the clustering algorithm. Points with the same cluster label belong to the same cluster, while points with different labels belong to distinct clusters. Next, the local clustering strategy LC (Local Clustering) for sub-nodes is introduced. Since each node can compute metrics only for its local data and the copied data contain only information about individual points, local clustering is applied solely to local data. Specifically, each node processes its local data to produce clustering results. This is identical to global clustering in terms of process, as the \(k\)-nearest neighbors (KNNs) identified by the S-KNN algorithm are accurate, ensuring precise values for the \(DCM\) and \(\rho\) metrics. Differentiating between boundary and internal points hinges on the threshold for the \(DCM\) metric and the proportion of KNN points with higher density. To facilitate this, the density values (\(\rho\)) of copied points must be imported from other nodes. Then, using the approach outlined in Section 3.2, the local data are divided into internal and boundary points. Finally, the single-machine local expansion algorithm LE is applied to cluster the local data. This completes the preliminary clustering process for each sub-node in a distributed environment. Algorithm 4 provides the pseudocode for the local clustering algorithm LC at any given sub-node. ```
0: Local dataset \(LDT\), copied dataset \(CDT\)
0: Initial clusters \(C_{1},C_{2},\ldots,C_{m}\)
1: Utilize Algorithm 2 (S-KNN) to determine the \(k\)-nearest neighbors (KNNs) for all points in the local dataset \(LDT\)
2:for each \(p_{i}\in LDT\)do
3: Compute the \(DCM\) value \(DCM_{i}\) of \(p_{i}\) using Equation (1)
4: Compute the density value \(\rho_{i}\) of \(p_{i}\) using Equation (7)
5:endfor
6:for each \(p_{i}\in CDT\)do
7: Copy the density value \(\rho_{i}\) to the corresponding node
8:endfor
9: Distinguish all \(p_{i}\in LDT\) as either boundary points or internal points based on the boundary identification method described in Section 3.2
10: Perform clustering on the local dataset using Algorithm 3 (LE)
```
**Algorithm 4** Local clustering

#### 3.4.2 Global Clustering

In the preceding sections, the local clustering of data on individual sub-nodes was completed. However, in the entire data space, data points belonging to the same cluster may have been allocated to different sub-nodes during the data partitioning process. This situation could result in a single cluster being split and clustered into two or more separate clusters by different sub-nodes. To address this issue, this section introduces the concept of global clustering (GC).