added code for spectral clustering