## 3 Improved DBSCAN Algorithm Based on Sparrow Search Algorithm
### Algorithm Pseudocode and Flowchart  
The key to the SSA-DBSCAN algorithm lies in choosing the optimal cluster quantity, the screening of the optimal solutions during execution, and the latter iterative solution process. The prior knowledge requirement for the dataset is less and the results are more accurate. Algorithm 1 presents the pseudocode for the SSA-DBSCAN algorithm, while Figure 3 illustrates its execution steps. ```
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{Fys}}\) values \(E_{\textit{Fys}}=\min\{\kappa(K),\max(K)\}\);
4: Get the range of Min\(P_{\textit{Fys}}\) values \(MinP_{\textit{Fys}}=[E(\min(K)),E(\max(K))]\);
5: Calculate the local density \(\rho\) and the sample point distance \(\delta\), Determine the number of clusters based on the distance relationship (\(\textit{best}\_n\));
6: Generate \((E_{\textit{Fys}},\ MinP_{\textit{Fys}})\) list of sparrow parameters based on \(E_{\textit{Fys}}\) and Min\(P_{\textit{Fys}}\);
7: While (\(\mathsf{t}<\mathsf{T}\));
8: Obtain the profile coefficient value \(\mathsf{s}(\mathsf{i})\) of an individual sparrow with the number of cluster \(\mathsf{n}\);
9: The solution that matches the number of clusters and has the largest Silhouette is the optimal solution;
10: Rank the fitness values and find the current best individual and the current worst individual;
11:\(R_{\textit{2}}=\textit{rund}\) (1)
12:for\(i=1\): \(PD\)
13: Using Equation (2) update the sparrow's location;
14: end for
15: for\(i=(PD+1)\): \(n\)
16: Using Equation (3) update the sparrow's location;
17:end for
18:for\(i=1\): \(SD\)
19: Using Equation (4) update the sparrow's location;
20:end for
21: Get the current new location;
22: If the new location is better than before, update it;
23:\(\mathsf{t}=\mathsf{t}+1\)
24:end while;
25: Initializing a collection of core objects;
26:for\(j=1,2,3,\ldots,\mathsf{m}\);
27: Determine the \(\epsilon\)-neighborhood of sample \(x_{j}N_{E_{\textit{Fys}}}(x_{j})\);
28:if\(|N_{E_{\textit{Fys}}}(x_{j})|\geq MinP_{\textit{Fys}}\)';
29: Add sample \(x_{j}\) to the set of core objects: \(\Omega=\Omega\cup\{x_{j}\}\);
30: end if;
31:end for;
32: Initialize the number of clusters: \(k=0\);
33: Initialize the set of unvisited samples: \(\Gamma=D\);
34:while\(\Omega\
eq i\);
35: Record the current set of unvisited samples: \(\Gamma_{\textit{old}}=\Gamma\);
36: Random selection of a core object \(o\in\Omega\), Initializing the queue \(Q=<o>\);
37:\(\Gamma=\Gamma\backslash\{o\}\);
38:while\(Q\
eq i\);
39: Fetch the first sample in the queue \(\mathsf{q}\);
40:if\(|N_{E_{\textit{Fys}}}(x_{j})|\geq MinP_{\textit{Fys}}\)';
41:\(\Delta=N_{E_{\textit{Fys}}}(q)\cap\Gamma\);
42: Add the sample in \(\Delta\) to the queue \(\mathsf{Q}\);
43:\(\Gamma=\Gamma\backslash\Delta\);
44:endif;
45:end while;
46:\(k\)=\(k+1\), Number of clusters generated \(\mathcal{C}_{k}=\Gamma_{\textit{old}}\backslash\Gamma\);
47:\(\Omega=\Omega\backslash\mathcal{C}_{k}\);
48:end while;
49: Cluster division \(C=\{C_{1},C_{2},C_{3},\ldots,C_{k}\}\)
```  
**Algorithm 1**SSA-DBSCAN  
### Algorithm Pseudocode and Flowchart  
The key to the SSA-DBSCAN algorithm lies in choosing the optimal cluster quantity, the screening of the optimal solutions during execution, and the latter iterative solution process. The prior knowledge requirement for the dataset is less and the results are more accurate. Algorithm 1 presents the pseudocode for the SSA-DBSCAN algorithm, while Figure 3 illustrates its execution steps.