拉普拉斯矩阵的谱分解,谱图卷积,图卷积演变过程
特征值(eigenvalue)特征向量(eigenvector)特征值分解(eigenvalue decomposition)
特征值分解和奇异值分解以及使用numpy实现
代码:
import numpy as np
from numpy import linalg as la
def unnormalized_laplacian(adj_matrix): # 先求度矩阵
R = np.sum(adj_matrix, axis=1)
degreeMatrix = np.diag(R)
return degreeMatrix - adj_matrix
def normalized_laplacian(adj_matrix):
R = np.sum(adj_matrix, axis=1)
R_sqrt = 1/np.sqrt(R)
D_sqrt = np.diag(R_sqrt)
I = np.eye(adj_matrix.shape[0])
return I - D_sqrt * adj_matrix * D_sqrt
if __name__ == "__main__":
AA = np.array([[4,3],[8,6]])
A = unnormalized_laplacian(AA)
u,sigma,vt = la.svd(A)
print(A)
S = np.diag(sigma)
tmp = np.dot(u,S)
print(np.dot(tmp,vt))