⏳ computing eigenvectors…
Spectral clusters (colour = assignment) k-NN similarity graph edges
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Spectral Clustering — Graph Laplacian Explorer

Spectral clustering separates data by connectivity on a similarity graph rather than by straight-line distance, which lets it correctly untangle non-convex shapes — interleaving moons, nested rings — that defeat centroid-based methods like k-means. This simulator builds a real k-nearest-neighbour similarity graph with a Gaussian kernel, forms the graph Laplacian L = D − W, and diagonalises it live with a from-scratch cyclic Jacobi eigenvalue solver to obtain the low-dimensional spectral embedding, then runs k-means inside that embedding. Adjust the kernel bandwidth, neighbourhood size and cluster count, toggle the raw similarity graph on or off, and compare directly against plain k-means running on the same points to see exactly why the spectral approach wins on curved cluster boundaries.