> ## Documentation Index
> Fetch the complete documentation index at: https://shapely.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Spectral Clustering

>  Spectral Clustering uses a similarity graph and its mathematical properties (eigenvalues) to discover complex, non-convex cluster shapes that traditional algorithms like K-Means cannot handle.

It is particularly effective when clusters have irregular, non-spherical boundaries. 

<Note>
  Spectral Clustering excels at finding clusters with **non-convex shapes** (e.g., L-shaped, crescent-shaped regions). If K-Means fails to capture the natural grouping in your data, try Spectral Clustering.
</Note>

### Use Cases

* **Complex spatial patterns**: When building layouts or urban patterns form non-convex shapes (e.g., L-shaped building clusters, ring-shaped arrangements).
* **Connectivity-based grouping**: Group geometries based on their adjacency relationships rather than just distance.
* **Irregular cluster shapes**: When K-Means produces unsatisfactory results because clusters are not spherical.

<a href="/images/ML/Spectral Clustering.png" target="_blank">
  <img src="https://mintcdn.com/shapely/k8EK4RW_OYOqKd74/images/ML/Spectral%20Clustering.png?fit=max&auto=format&n=k8EK4RW_OYOqKd74&q=85&s=b4c7688e815601ff30c27fe8f788a6ed" className="pointer-events-none" style={{ borderRadius: '0.5rem', border: '1px solid rgba(0,0,0,0.1)' }} width="2119" height="965" data-path="images/ML/Spectral Clustering.png" />
</a>
