| Algorithm 1 Divide_Datasets. | ||
| Input: Multi-density Dataset D | ||
| Output: Dataset summary after dividing the dataset DD | ||
| 1 | X = read(D) // read data into X | |
| 2 | disMat = squareform(X) // Calculate the distance between any two points. | |
| 3 | for I in disMat | |
| 4 | i.sort() // Sort each row of data | |
| 5 | array.append(i[k]) // The kth nearest neighbor distance of each point is stored in an array. | |
| 6 | Use plt.plot to draw a distance line chart on the array; | |
| 7 | Calculate array[i + 1]-array[i] successively from the figure to find the point with obvious height difference, and mark array[i + 1] as the bifurcation point; | |
| 8 | Use index binding to divide the dataset into two parts left and right of the bifurcation point; | |
| 9 | return DD | |