图1 定义1.2: The order of a graph, ∣G∣, is the size of the set of vertices, ∣V∣. 在这里我将 “order of a graph” 称为图的阶,它就是图中顶点的个数。上图中∣G1∣=4。 定义1.3 The degree of a vertex, deg(v) is the number of edges that are incident with the vertex. 顶点的度(the degree of the vertex)表示从这个顶点发出的edges的数量。对于 G1 而言,deg(v1)=1,deg(v2)=2,deg(v3)=1,deg(v4)=0。我们称0度的顶点为孤立点(isolated vertex),称1度点为悬垂点(pendant vertex),如图1中,v4 是孤立点,而v1,v3 是悬垂点。 定义1.4 A walk in a graph is a sequence of alternating vertices and edges that starts and ends at a vertex. A walk of length n is a walk with n edges. Consecutive vertices in the sequence must be connected by an edge in the graph. Walk——路径(有时也可解释为“游走”、“漫步”),在图中的路径,即从图中一个顶点到另一个顶点,要求这条路径上的前后顶点之间必须有边相连,此walk经过多少条边,则为walk的长度。 定义1.5 A closed walk is a sequence of alternating vertices and edges that starts and ends at the same vertex. Closed walk——闭环路径,即路径从一个顶点开始,并结束于同一顶点。 定义1.6 A cycle is a closed walk which contains any edge at most one time. Cycle——环,在闭环路径中,图的任何边都最多只能出现一次。 定义1.7 一个图G被称为连通的(connected),只需要在任意两个顶点之间存在一条长度为k的路径(walk),1≤k≤n−1,n=∣G∣ 定义1.8 图G的直径(diameter),它等于图中两个顶点最远的距离 我们可以用一幅图画(picture)来描述一个图(graph),圆圈表示顶点,圆圈之间的连线表示边,如图1,另外,我们也可以用一个矩阵来表示graph,它们是等效的,而矩阵的表示方式使我们能通过代数的方法来研究graph,这是两个领域连通的关键。 定义1.9 The adjacency matrix, A, is an nn matrix where n=|G| that represents which vertices are connected by an edge. If vertex i and vertex j are adjacent then aij=1, otherwise aij=0. adjacency matrix——邻接矩阵,用矩阵的形式表示顶点之间有没有边连接,若G的阶是n,则它是nn矩阵。图1的graph可以表示为: A=⎣⎢⎢⎡0100101001000000⎦⎥⎥⎤ 因为G时simple graph,因此aii=0,即对角元素为0,这是因为图中 没有Loop。 定理2.1 The entries aij in Ak represent the number of walks of length k from vi to vj Ak表示k个邻接矩阵相乘,其中的元素aij表示漫步(walk)的步数为k时,两个顶点{vi,vj}之间路径(起止的顶点是{vi,vj})的总条数。即:the aij entry in Ak represent the number of walks of length k between vertices i and j. 如上例: A2=⎣⎢⎢⎡0100101001000000⎦⎥⎥⎤×⎣⎢⎢⎡0100101001000000⎦⎥⎥⎤=⎣⎢⎢⎡1010020010100000⎦⎥⎥⎤ A3=⎣⎢⎢⎡1010020010100000⎦⎥⎥⎤×⎣⎢⎢⎡0100101001000000⎦⎥⎥⎤=⎣⎢⎢⎡0200202002000000⎦⎥⎥⎤ 由上定义和定理,可知:一个n阶的全连通(任意两个顶点之间都有walk)图G,其直径必小于等于n-1,其上任意两点之间必有一条walk其长度小于等于n-1。
图4 完全连接 其Adjacency Matrix是: AKn=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢⎡0111⋮111011⋮111101⋮111110⋮11⋯⋯⋯⋯⋱⋯⋯1111⋮011111⋮10⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥⎤ 2.4、Bipartite Graph——二分图 A bipartite graph is a graph on n vertices where the vertices are partitioned into two independent sets, V1 and V2 such that there are no edges between vertices in the same set. 即顶点可分为两个集合:V1 and V2,同一集合中的顶点之间没有边,而不同集合的顶点之间可以有边,如图5。这其实就是两层神经网络节点之间的图的关系:
图5 二分图 其邻接矩阵是: A=[OBTBO]
3、Laplacian Matrix——拉普拉斯矩阵
定义3.1 The degree matrix, D, of a graph, G, is the diagonal matrix D=diag(d1,d2,⋯,dn), where di is the degree of vertex i. 度矩阵D,是由各顶点的度(degree)为对角元素所构成的对角矩阵。如:
图6 G的度矩阵(degree matrix) 定义3.2 For a simple graph, G, the laplacian matrix, L=D-A, where D is the degree matrix and A is the adjacency matrix. 关键的一个定义:Laplacian matrix, L=D-A。 Laplacian matrix是一个实对称矩阵(n*n),其特征值(eigenvalue)必大于等于零,表示为{v1,v2,⋯,vn},共n个,并按顺序排列,即:vi≥vj,for ∀i≥j。 定义3.3 The trace of a matrix is the sum of the entries along the main diagonal. 方阵的迹。 因而,对于邻接矩阵trace(A)=∑i=1nλi=0,对于Laplacian矩阵trace(L)=∑i=1nvi=∑i=1ndi=2⋅e(G),即Laplacian矩阵的迹是G的边的数量e(G)的2倍。 矩阵L,A,D 的关系举例如下:
可解得L的特征值是{v1,v2,v3,v4}={3,1,0,0},而adjacency matrix的特征值是{λ1,λ2,λ3,λ4}={2,0,0,−2}。所谓的spectrum of a graph指的就是图所对应的Laplacian Matrix的特征值。即{v1,v2,v3,v4}={3,1,0,0}就是上图的谱。 Laplacian Matrix(矩阵L)具有如下性质: 1、xTLx=21∑i,j=1nwij(xi−xj)2 for ∀x∈Rn 2、L≥0 if wij≥0 for all i,j 3、L⋅1=0 4、If the underlying graph of G is connected, then 0=λ1<λ2≤λ3⋯≤λn 5、If the underlying graph of G is connected, then the dimension of the nullspace of L is 1. 对矩阵 L 归一化,有: L=D−21LD−21=D−21(D−A)D−21=I−S 于是归一化Laplacian的元素为: L(i,j)=⎩⎪⎨⎪⎧1,−dudv1,0,if u=v and dv̸=0if u and v are adjacentotherwise 谱反映了图的特性,可作为图的结构的研究方法。
本文主要是参考【1】,因其内容较基础和简单。 参考文献 1、《Spectral of Simple Graphs》Owen Jones, Whitman College, May 13, 2013 2、《Sprectral Graph Theory》Fan R. K. Chung