How is a similarity graph constructed from unlabelled data in spectral clustering?

Last updated 11 November 2026

  • Define pairwise similarity, usually a Gaussian kernel exp(-||x_i - x_j||² / 2σ²) on scaled features. Points become nodes and similarities become edge weights.

  • Sparsify via ε-neighbourhood, k-NN (symmetrized, or mutual k-NN for varying densities), or keep it fully connected (dense O(n²), locality set only by σ).

  • Set σ by median distance or local scaling (σ_i = distance to k-th neighbour). Start with k ≈ log(n) and ensure the graph is connected. Sparse graphs scale far better.

  • https://medium.com/@roiyeho/spectral-clustering-50aee862d300
  • https://eric-bunch.github.io/blog/spectral-clustering
  • https://scikit-learn.org/stable/modules/generated/sklearn.cluster.SpectralClustering.html
All Clustering interview questions