调和矩阵

来自testwiki
imported>InternetArchiveBot2023年12月8日 (五) 21:07的版本 (Add 1 book for verifiability (20231207)) #IABot (v2.0.9.5) (GreenC bot
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到导航 跳转到搜索

Template:Roughtranslation图论中,调和矩阵harmonic matrix),也称拉普拉斯矩阵拉氏矩阵Laplacian matrix)、离散拉普拉斯discrete Laplacian),是矩阵表示。[1]

调和矩阵也是拉普拉斯算子离散化。换句话说,调和矩阵的缩放极限拉普拉斯算子。它在机器学习物理学中有很多应用。

定义

若G是简单,G有n个顶点,A是邻接矩阵,D是度数矩阵,则调和矩阵[1]

L=DA

Li,j:={deg(vi)if i=j1if ij and vi is adjacent to vj0otherwise

动机

这跟拉普拉斯算子有什么关系?若f 是加权图G的顶点函数,则[2]

E(f)=w(uv)(f(u)f(v))2/2=ftLf

w是边的权重函数。u、v是顶点。f = (f(1), ..., f(n)) 是n维的矢量。上面泛函也称为Dirichlet泛函。[3]

接续矩阵

而且若K是接续矩阵(incidence matrix),则[2]

Kev={1,if v=i1,if v=j0,otherwise.

L=KtK

Kf 是f 的图梯度。另外,特征值满足

λi=𝐯iTL𝐯i=𝐯iTMTM𝐯i=(M𝐯i)T(M𝐯i)

举例

度矩阵 邻接矩阵 调和矩阵
(200000030000002000000300000030000001) (010010101010010100001011110100000100) (210010131010012100001311110130000101)

其他形式

对称正規化调和矩阵

Lsym:=D12LD12=ID12AD12

Li,jsym:={1if i=j and deg(vi)01deg(vi)deg(vj)if ij and vi is adjacent to vj0otherwise.

注意[4]

λ = g,Lsymgg,g = g,D12LD12gg,g = f,LfD12f,D12f = uv(f(u)f(v))2vf(v)2dv  0,

Lrw:=D1L=ID1A

Li,jrw:={1if i=j and deg(vi)01deg(vi)if ij and vi is adjacent to vj0otherwise.

例如,离散的冷却定律使用调和矩阵[5]

dϕidt=kjAij(ϕiϕj)=k(ϕijAijjAijϕj)=k(ϕi deg(vi)jAijϕj)=kj(δij deg(vi)Aij)ϕj=kj(ij)ϕj.

使用矩阵矢量

dϕdt=k(DA)ϕ=kLϕ

dϕdt+kLϕ=0

解是

d(ici𝐯i)dt+kL(ici𝐯i)=0i[dcidt𝐯i+kciL𝐯i]=i[dcidt𝐯i+kciλi𝐯i]=dcidt+kλici=0

ci(t)=ci(0)ekλit

ci(0)=ϕ(0),𝐯i

平衡举动

limtϕ(t)的时候,

limtekλit={0ifλi>01ifλi=0}

limtϕ(t)=c(0),𝐯𝟏𝐯𝟏

𝐯𝟏=1N[1,1,...,1]

limtϕj(t)=1Ni=1Nci(0)

MATLAB代码

N = 20;%The number of pixels along a dimension of the image
A = zeros(N, N);%The image
Adj = zeros(N*N, N*N);%The adjacency matrix

%Use 8 neighbors, and fill in the adjacency matrix
dx = [-1, 0, 1, -1, 1, -1, 0, 1];
dy = [-1, -1, -1, 0, 0, 1, 1, 1];
for x = 1:N
   for y = 1:N
       index = (x-1)*N + y;
       for ne = 1:length(dx)
           newx = x + dx(ne);
           newy = y + dy(ne);
           if newx > 0 && newx <= N && newy > 0 && newy <= N
               index2 = (newx-1)*N + newy;
               Adj(index, index2) = 1;
           end
       end
   end
end

%%%BELOW IS THE KEY CODE THAT COMPUTES THE SOLUTION TO THE DIFFERENTIAL
%%%EQUATION
Deg = diag(sum(Adj, 2));%Compute the degree matrix
L = Deg - Adj;%Compute the laplacian matrix in terms of the degree and adjacency matrices
[V, D] = eig(L);%Compute the eigenvalues/vectors of the laplacian matrix
D = diag(D);

%Initial condition (place a few large positive values around and
%make everything else zero)
C0 = zeros(N, N);
C0(2:5, 2:5) = 5;
C0(10:15, 10:15) = 10;
C0(2:5, 8:13) = 7;
C0 = C0(:);

C0V = V'*C0;%Transform the initial condition into the coordinate system 
%of the eigenvectors
for t = 0:0.05:5
   %Loop through times and decay each initial component
   Phi = C0V.*exp(-D*t);%Exponential decay for each component
   Phi = V*Phi;%Transform from eigenvector coordinate system to original coordinate system
   Phi = reshape(Phi, N, N);
   %Display the results and write to GIF file
   imagesc(Phi);
   caxis([0, 10]);
   title(sprintf('Diffusion t = %3f', t));
   frame = getframe(1);
   im = frame2im(frame);
   [imind, cm] = rgb2ind(im, 256);
   if t == 0
      imwrite(imind, cm, 'out.gif', 'gif', 'Loopcount', inf, 'DelayTime', 0.1); 
   else
      imwrite(imind, cm, 'out.gif', 'gif', 'WriteMode', 'append', 'DelayTime', 0.1);
   end
end
GIF:离散拉普拉斯过程,使用拉普拉斯矩阵

应用

参考文献

阅读

  • Template:Cite book
  • B. Bollobás, Modern Graph Theory, Springer-Verlag (1998, corrected ed. 2013), Template:ISBN, Chapters II.3 (Vector Spaces and Matrices Associated with Graphs), VIII.2 (The Adjacency Matrix and the Laplacian), IX.2 (Electrical Networks and Random Walks).