cds2.spectral
Spectral graph theory - Laplacians, Fiedler vectors, algebraic connectivity and spectral clustering.
Spectral graph theory: Laplacians, Fiedler vectors, spectral clustering.
laplacian(adj, normalized=False)
Graph Laplacian L = D - W (combinatorial or symmetric-normalized).
Source code in src/cds2/spectral.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
fiedler_vector(adj)
Eigenvector of the second-smallest Laplacian eigenvalue.
Sign encodes the best bipartition; smoothness over the graph makes it a canonical 1-D embedding.
Source code in src/cds2/spectral.py
52 53 54 55 56 57 58 59 60 61 62 63 64 | |
algebraic_connectivity(adj)
Second-smallest Laplacian eigenvalue - global connectivity measure.
Source code in src/cds2/spectral.py
67 68 69 70 71 72 73 74 75 | |
spectral_cluster(adj, n_clusters, seed=None, normalized=True)
Cluster graph nodes by k-means on the bottom Laplacian eigenvectors.
Source code in src/cds2/spectral.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |