Skip to main content
. 2016 Oct 13;16(10):1701. doi: 10.3390/s16101701
Algorithm 1: Spectral Clustering Algorithm
Input: Dataset, number of clusters k, parameter σ and number of iterations iter
Output: the set of k clusters
/* Note the symbols of “/*” and “*/” represent comments in this algorithm. */
1 Calculate the affinity matrix ARn×n and define Aij=exp(-si-sj2/2σ2)
/* In which Si and Sj are the original data points i and j, repctively. */
2 If ij then the Aii=0
3 The D is the diagonal degree matrix and computed with elements: di=j=1nAij Given a graph G with n input vertices, the Laplacian matrix L(n×n)=D-A
4 Find the k largest eigenvectors of the matrix L and [x1x2xk]R(n×k)
5 Generate matrix y by renormalizing each x row, Yij=Xij/(jXij2)1/2
6 Minimize the distortion of each row Y to regard as the point in clustering term Rk using any clustering algorithm, such as a distance-based clustering approach.
7 Finally, the original point si is assigned to cluster j when the row of yi belongs to the cluster j.
8 return the set of k clusters and cluster centre.