## 3 Improved DBSCAN Algorithm Based on Sparrow Search Algorithm
### Algorithm Pseudocode and Flowchart
```
0: Sample set \(D=\{x_{1},x_{2},x_{3},\ldots,x_{m}\}\), Population Size \(\mathsf{S}\), Number of iterations \(\mathsf{T}\);
1: Calculate the distance matrix for dataset \(\mathsf{D}\); \(\mathsf{D}^{*}=\{\xi_{1},\xi_{2},\xi_{3},\ldots\xi_{m}\}\)
2: Calculation the median of each column in \(\mathsf{D}^{*}K=\{k_{1},k_{2},k_{3},\ldots k_{m}\}\);
3: Get the range of \(E_{\textit

### Algorithm Complexity Analysis

For a dataset containing n samples, the spatial complexity of DBSCAN primarily arises from assigning cluster labels and categorizing points as core, boundary, or noise. Therefore, the spatial complexity of the DBSCAN algorithm is \(O(n)\). In contrast, the integration of the Sparrow Search Algorithm's iterative optimization process into SSA-DBSCAN leads to an increase in the spatial complexity of the fitness function. Assuming the Sparrow Search Algorithm generates an additional sample size of m, this yields a space complexity of \(O(m)\). Consequently, the total spatial complexity of the SSA-DBSCAN algorithm is the overall spatial complexity of SSA-DBSCAN, which is \(O(n+m)\). The time complexity of the SSA-DBSCAN algorithm is mainly determined by the optimization iteration process of the DBSCAN algorithm and sparrow optimization algorithm. For the case where the dataset contains n sample points, the time complexity of DBSCAN largely depends on the duration needed to identify the Eps neighborhood of each sample point and determine its category based on density criteria. In the worst case, the DBSCAN algorithm needs to calculate the distance between each point and all other points, so the time complexity of the DBSCAN algorithm is \(O(n^{2})\). The Sparrow Search Algorithm's time complexity cost is primarily attributed to its iterative optimization procedure and the repeated evaluation of the fitness function across all individuals in the population. The time complexity in the optimization stage is calculated as \(O(2 ST)\), given a population size of S and T optimization iterations. The time complexity of the total number of iterations during the iteration process is \(O(n^{2}T)\). The time cost associated with optimizing the fitness function is largely attributed to the calculation of silhouette coefficients. When evaluating the clustering effect, it is necessary to calculate the contour coefficient of each sample point and take the average of the contour coefficients of all sample points to obtain the total contour coefficient. Therefore,

Figure 3: Core algorithm flowchart. the time complexity of the overall contour coefficient is \(O(n^{2})\). Accordingly, the total time complexity of the SSA-DBSCAN algorithm is less than \(O(n^{2}(2+T)+2 ST)\). To sum up, the complexity of the SSA-DBSCAN algorithm is slightly higher than that of the traditional DBSCAN algorithm, but it is consistent in magnitude with the DBSCSN algorithm while ensuring the accuracy of clustering in general scenarios. ## 4 Experiments and Results Analysis

### Experimental Environment and Comparison Algorithms

The SSA-DBSCAN algorithm was run on a 64-bit Windows 10 system, with hardware specifications including an Intel Core i7-9750H processor, 16 GB of RAM, and a 1 TB hard drive. In these comparison algorithms, the RNN-DBSCAN [12] algorithm advances the classic DBSCAN framework by leveraging reverse \(k\)-nearest neighbor dynamics. By introducing a unified control variable, \(k\), which signifies the count of requisite reverse nearest neighbors, it simplifies the original Eps and MinPts parameters. The process of clustering is then executed through the calibration of the \(k\) value. Similarly, the KANN-DBSCAN [13] algorithm applies a nearest neighbor strategy to estimate appropriate parameter values. By computing the average distance to each point's nearest neighbors, the algorithm estimates Eps and determines MinPts through mathematical expectation. It then constructs a pool of candidate parameters, selecting the combination that yields the highest clustering effectiveness.