Given a simple graph G {\displaystyle G} with n {\displaystyle n} vertices v 1 , … , v n {\displaystyle v_{1},\ldots ,v_{n}} , its Laplacian matrix L n × n {\textstyle L_{n\times n}} is defined element-wise as1
or equivalently by the matrix
where D is the degree matrix, and A is the graph's adjacency matrix. Since G {\textstyle G} is a simple graph, A {\textstyle A} only contains 1s or 0s and its diagonal elements are all 0s.
Here is a simple example of a labelled, undirected graph and its Laplacian matrix.
We observe for the undirected graph that both the adjacency matrix and the Laplacian matrix are symmetric and that the row- and column-sums of the Laplacian matrix are all zeros (which directly implies that the Laplacian matrix is singular).
For directed graphs, either the indegree or outdegree might be used, depending on the application, as in the following example:
In the directed graph, the adjacency matrix and Laplacian matrix are asymmetric. In its Laplacian matrix, column-sums or row-sums are zero, depending on whether the indegree or outdegree has been used.
The | v | × | e | {\textstyle |v|\times |e|} oriented incidence matrix B with element Bve for the vertex v and the edge e (connecting vertices v i {\textstyle v_{i}} and v j {\textstyle v_{j}} , with i ≠ j) is defined by
Even though the edges in this definition are technically directed, their directions can be arbitrary, still resulting in the same symmetric Laplacian | v | × | v | {\textstyle |v|\times |v|} matrix L defined as
where B T {\textstyle B^{\textsf {T}}} is the matrix transpose of B.
An alternative product B T B {\displaystyle B^{\textsf {T}}B} defines the so-called | e | × | e | {\textstyle |e|\times |e|} edge-based Laplacian, as opposed to the original commonly used vertex-based Laplacian matrix L.
The Laplacian matrix of a directed graph is by definition generally non-symmetric, while, e.g., traditional spectral clustering is primarily developed for undirected graphs with symmetric adjacency and Laplacian matrices. A trivial approach to applying techniques requiring the symmetry is to turn the original directed graph into an undirected graph and build the Laplacian matrix for the latter.
In the matrix notation, the adjacency matrix of the undirected graph could, e.g., be defined as a Boolean sum of the adjacency matrix A {\displaystyle A} of the original directed graph and its matrix transpose A T {\displaystyle A^{T}} , where the zero and one entries of A {\displaystyle A} are treated as logical, rather than numerical, values, as in the following example:
A vertex with a large degree, also called a heavy node, results in a large diagonal entry in the Laplacian matrix dominating the matrix properties. Normalization is aimed to make the influence of such vertices more equal to that of other vertices, by dividing the entries of the Laplacian matrix by the vertex degrees. To avoid division by zero, isolated vertices with zero degrees are excluded from the process of the normalization.
The symmetrically normalized Laplacian matrix is defined as:2
where D + {\displaystyle D^{+}} is the Moore–Penrose inverse.
The elements of L sym {\textstyle L^{\text{sym}}} are thus given by
The symmetrically normalized Laplacian matrix is symmetric if and only if the adjacency matrix is symmetric.
For a non-symmetric adjacency matrix of a directed graph, either of indegree and outdegree can be used for normalization:
The left (random-walk) normalized Laplacian matrix is defined as:
where D + {\displaystyle D^{+}} is the Moore–Penrose inverse. The elements of L rw {\textstyle L^{\text{rw}}} are given by
Similarly, the right normalized Laplacian matrix is defined as
The left or right normalized Laplacian matrix is not symmetric if the adjacency matrix is symmetric, except for the trivial case of all isolated vertices. For example,
The example also demonstrates that if G {\displaystyle G} has no isolated vertices, then D + A {\displaystyle D^{+}A} right stochastic and hence is the matrix of a random walk, so that the left normalized Laplacian L rw := D + L = I − D + A {\displaystyle L^{\text{rw}}:=D^{+}L=I-D^{+}A} has each row summing to zero. Thus we sometimes alternatively call L rw {\displaystyle L^{\text{rw}}} the random-walk normalized Laplacian. In the less uncommonly used right normalized Laplacian L D + = I − A D + {\displaystyle LD^{+}=I-AD^{+}} each column sums to zero since A D + {\displaystyle AD^{+}} is left stochastic.
For a non-symmetric adjacency matrix of a directed graph, one also needs to choose indegree or outdegree for normalization:
The left out-degree normalized Laplacian with row-sums all 0 relates to right stochastic D out + A {\displaystyle D_{\text{out}}^{+}A} , while the right in-degree normalized Laplacian with column-sums all 0 contains left stochastic A D in + {\displaystyle AD_{\text{in}}^{+}} .
Common in applications graphs with weighted edges are conveniently defined by their adjacency matrices where values of the entries are numeric and no longer limited to zeros and ones. In spectral clustering and graph-based signal processing, where graph vertices represent data points, the edge weights can be computed, e.g., as inversely proportional to the distances between pairs of data points, leading to all weights being non-negative with larger values informally corresponding to more similar pairs of data points. Using correlation and anti-correlation between the data points naturally leads to both positive and negative weights. Most definitions for simple graphs are trivially extended to the standard case of non-negative weights, while negative weights require more attention, especially in normalization.
The Laplacian matrix is defined by
where D is the degree matrix and A is the adjacency matrix of the graph.
Graph self-loops, manifesting themselves by non-zero entries on the main diagonal of the adjacency matrix, are allowed but do not affect the graph Laplacian values.
For graphs with weighted edges one can define a weighted incidence matrix B and use it to construct the corresponding symmetric Laplacian as L = B B T {\displaystyle L=BB^{\textsf {T}}} . An alternative cleaner approach, described here, is to separate the weights from the connectivity: continue using the incidence matrix as for regular graphs and introduce a matrix just holding the values of the weights. A spring system is an example of this model used in mechanics to describe a system of springs of given stiffnesses and unit length, where the values of the stiffnesses play the role of the weights of the graph edges.
We thus reuse the definition of the weightless | v | × | e | {\textstyle |v|\times |e|} incidence matrix B with element Bve for the vertex v and the edge e (connecting vertexes v i {\textstyle v_{i}} and v j {\textstyle v_{j}} , with i > j) defined by
We now also define a diagonal | e | × | e | {\textstyle |e|\times |e|} matrix W containing the edge weights. Even though the edges in the definition of B are technically directed, their directions can be arbitrary, still resulting in the same symmetric Laplacian | v | × | v | {\textstyle |v|\times |v|} matrix L defined as
The construction is illustrated in the following example, where every edge e i {\textstyle e_{i}} is assigned the weight value i, with i = 1 , 2 , 3 , 4. {\textstyle i=1,2,3,4.}
Just like for simple graphs, the Laplacian matrix of a directed weighted graph is by definition generally non-symmetric. The symmetry can be enforced by turning the original directed graph into an undirected graph first before constructing the Laplacian. The adjacency matrix of the undirected graph could, e.g., be defined as a sum of the adjacency matrix A {\displaystyle A} of the original directed graph and its matrix transpose A T {\displaystyle A^{T}} as in the following example:
where the zero and one entries of A {\displaystyle A} are treated as numerical, rather than logical as for simple graphs, values, explaining the difference in the results - for simple graphs, the symmetrized graph still needs to be simple with its symmetrized adjacency matrix having only logical, not numerical values, e.g., the logical sum is 1 v 1 = 1, while the numeric sum is 1 + 1 = 2.
Alternatively, the symmetric Laplacian matrix can be calculated from the two Laplacians using the indegree and outdegree, as in the following example:
The sum of the out-degree Laplacian transposed and the in-degree Laplacian equals to the symmetric Laplacian matrix.
The goal of normalization is, like for simple graphs, to make the diagonal entries of the Laplacian matrix to be all unit, also scaling off-diagonal entries correspondingly. In a weighted graph, a vertex may have a large degree because of a small number of connected edges but with large weights just as well as due to a large number of connected edges with unit weights.
Graph self-loops, i.e., non-zero entries on the main diagonal of the adjacency matrix, do not affect the graph Laplacian values, but may need to be counted for calculation of the normalization factors.
The symmetrically normalized Laplacian is defined as
where L is the unnormalized Laplacian, A is the adjacency matrix, D is the degree matrix, and D + {\displaystyle D^{+}} is the Moore–Penrose inverse. Since the degree matrix D is diagonal, its reciprocal square root ( D + ) 1 / 2 {\textstyle (D^{+})^{1/2}} is just the diagonal matrix whose diagonal entries are the reciprocals of the square roots of the diagonal entries of D. If all the edge weights are nonnegative then all the degree values are automatically also nonnegative and so every degree value has a unique positive square root. To avoid the division by zero, vertices with zero degrees are excluded from the process of the normalization, as in the following example:
The symmetrically normalized Laplacian is a symmetric matrix if and only if the adjacency matrix A is symmetric and the diagonal entries of D are nonnegative, in which case we can use the term the symmetric normalized Laplacian.
The symmetric normalized Laplacian matrix can be also written as
using the weightless | v | × | e | {\textstyle |v|\times |e|} incidence matrix B and the diagonal | e | × | e | {\textstyle |e|\times |e|} matrix W containing the edge weights and defining the new | v | × | e | {\textstyle |v|\times |e|} weighted incidence matrix S = ( D + ) 1 / 2 B W 1 / 2 {\textstyle S=(D^{+})^{1/2}BW^{{1}/{2}}} whose rows are indexed by the vertices and whose columns are indexed by the edges of G such that each column corresponding to an edge e = {u, v} has an entry 1 d u {\textstyle {\frac {1}{\sqrt {d_{u}}}}} in the row corresponding to u, an entry − 1 d v {\textstyle -{\frac {1}{\sqrt {d_{v}}}}} in the row corresponding to v, and has 0 entries elsewhere.
The random walk normalized Laplacian is defined as
where D is the degree matrix. Since the degree matrix D is diagonal, its inverse D + {\textstyle D^{+}} is simply defined as a diagonal matrix, having diagonal entries which are the reciprocals of the corresponding diagonal entries of D. For the isolated vertices (those with degree 0), a common choice is to set the corresponding element L i , i rw {\textstyle L_{i,i}^{\text{rw}}} to 0. The matrix elements of L rw {\textstyle L^{\text{rw}}} are given by
The name of the random-walk normalized Laplacian comes from the fact that this matrix is L rw = I − P {\textstyle L^{\text{rw}}=I-P} , where P = D + A {\textstyle P=D^{+}A} is simply the transition matrix of a random walker on the graph, assuming non-negative weights. For example, let e i {\textstyle e_{i}} denote the i-th standard basis vector. Then x = e i P {\textstyle x=e_{i}P} is a probability vector representing the distribution of a random walker's locations after taking a single step from vertex i {\textstyle i} ; i.e., x j = P ( v i → v j ) {\textstyle x_{j}=\mathbb {P} \left(v_{i}\to v_{j}\right)} . More generally, if the vector x {\textstyle x} is a probability distribution of the location of a random walker on the vertices of the graph, then x ′ = x P t {\textstyle x'=xP^{t}} is the probability distribution of the walker after t {\textstyle t} steps.
The random walk normalized Laplacian can also be called the left normalized Laplacian L rw := D + L {\displaystyle L^{\text{rw}}:=D^{+}L} since the normalization is performed by multiplying the Laplacian by the normalization matrix D + {\displaystyle D^{+}} on the left. It has each row summing to zero since P = D + A {\displaystyle P=D^{+}A} is right stochastic, assuming all the weights are non-negative.
In the less uncommonly used right normalized Laplacian L D + = I − A D + {\displaystyle LD^{+}=I-AD^{+}} each column sums to zero since A D + {\displaystyle AD^{+}} is left stochastic.
Negative weights present several challenges for normalization:
For an (undirected) graph G and its Laplacian matrix L with eigenvalues λ 0 ≤ λ 1 ≤ ⋯ ≤ λ n − 1 {\textstyle \lambda _{0}\leq \lambda _{1}\leq \cdots \leq \lambda _{n-1}} :
Because λ i {\textstyle \lambda _{i}} can be written as the inner product of the vector M v i {\textstyle M\mathbf {v} _{i}} with itself, this shows that λ i ≥ 0 {\textstyle \lambda _{i}\geq 0} and so the eigenvalues of L {\textstyle L} are all non-negative.
i.e., L rw {\textstyle L^{\text{rw}}} is similar to the normalized Laplacian L sym {\textstyle L^{\text{sym}}} . For this reason, even if L rw {\textstyle L^{\text{rw}}} is in general not symmetric, it has real eigenvalues — exactly the same as the eigenvalues of the normalized symmetric Laplacian L sym {\textstyle L^{\text{sym}}} .
The graph Laplacian matrix can be further viewed as a matrix form of the negative discrete Laplace operator on a graph approximating the negative continuous Laplacian operator obtained by the finite difference method. (See Discrete Poisson equation)4 In this interpretation, every graph vertex is treated as a grid point; the local connectivity of the vertex determines the finite difference approximation stencil at this grid point, the grid size is always one for every edge, and there are no constraints on any grid points, which corresponds to the case of the homogeneous Neumann boundary condition, i.e., free boundary. Such an interpretation allows one, e.g., generalizing the Laplacian matrix to the case of graphs with an infinite number of vertices and edges, leading to a Laplacian matrix of an infinite size.
The generalized Laplacian Q {\displaystyle Q} is defined as:5
Notice the ordinary Laplacian is a generalized Laplacian.
The Laplacian of a graph was first introduced to model electrical networks. In an alternating current (AC) electrical network, real-valued resistances are replaced by complex-valued impedances. The weight of edge (i, j) is, by convention, minus the reciprocal of the impedance directly between i and j. In models of such networks, the entries of the adjacency matrix are complex, but the Kirchhoff matrix remains symmetric, rather than being Hermitian. Such a matrix is usually called an "admittance matrix", denoted Y {\displaystyle Y} , rather than a "Laplacian". This is one of the rare applications that give rise to complex symmetric matrices.
There are other situations in which entries of the adjacency matrix are complex-valued, and the Laplacian does become a Hermitian matrix. The Magnetic Laplacian for a directed graph with real weights w i j {\displaystyle w_{ij}} is constructed as the Hadamard product of the real symmetric matrix of the symmetrized Laplacian and the Hermitian phase matrix with the complex entries
which encode the edge direction into the phase in the complex plane. In the context of quantum physics, the magnetic Laplacian can be interpreted as the operator that describes the phenomenology of a free charged particle on a graph, which is subject to the action of a magnetic field and the parameter q {\displaystyle q} is called electric charge.6 In the following example q = 1 / 4 {\displaystyle q=1/4} :
The deformed Laplacian is commonly defined as
where I is the identity matrix, A is the adjacency matrix, D is the degree matrix, and s is a (complex-valued) number. 7 The standard Laplacian is just Δ ( 1 ) {\textstyle \Delta (1)} and Δ ( − 1 ) = D + A {\textstyle \Delta (-1)=D+A} is the signless Laplacian.
The signless Laplacian is defined as
where D {\displaystyle D} is the degree matrix, and A {\displaystyle A} is the adjacency matrix.8 Like the signed Laplacian L {\displaystyle L} , the signless Laplacian Q {\displaystyle Q} also is positive semi-definite as it can be factored as
where R {\textstyle R} is the incidence matrix. Q {\displaystyle Q} has a 0-eigenvector if and only if it has a bipartite connected component (isolated vertices being bipartite connected components). This can be shown as
This has a solution where x ≠ 0 {\displaystyle \mathbf {x} \neq \mathbf {0} } if and only if the graph has a bipartite connected component.
An analogue of the Laplacian matrix can be defined for directed multigraphs.9 In this case the Laplacian matrix L is defined as
where D is a diagonal matrix with Di,i equal to the outdegree of vertex i and A is a matrix with Ai,j equal to the number of edges from i to j (including loops).
Chung, Fan (1997) [1992]. Spectral Graph Theory. American Mathematical Society. ISBN 978-0821803158. 978-0821803158 ↩
Smola, Alexander J.; Kondor, Risi (2003), "Kernels and regularization on graphs", Learning Theory and Kernel Machines: 16th Annual Conference on Learning Theory and 7th Kernel Workshop, COLT/Kernel 2003, Washington, DC, USA, August 24–27, 2003, Proceedings, Lecture Notes in Computer Science, vol. 2777, Springer, pp. 144–158, CiteSeerX 10.1.1.3.7020, doi:10.1007/978-3-540-45167-9_12, ISBN 978-3-540-40720-1. 978-3-540-40720-1 ↩
Godsil, C.; Royle, G. (2001). Algebraic Graph Theory, Graduate Texts in Mathematics. Springer-Verlag. ↩
Satoshi Furutani; Toshiki Shibahara; Mitsuaki Akiyama; Kunio Hato; Masaki Aida (2020). Graph Signal Processing for Directed Graphs based on the Hermitian Laplacian (PDF). ECML PKDD 2019: Machine Learning and Knowledge Discovery in Databases. pp. 447–463. doi:10.1007/978-3-030-46150-8_27. https://ecmlpkdd2019.org/downloads/paper/499.pdf ↩
Morbidi, F. (2013). "The Deformed Consensus Protocol" (PDF). Automatica. 49 (10): 3049–3055. doi:10.1016/j.automatica.2013.07.006. S2CID 205767404. http://hal.archives-ouvertes.fr/docs/00/96/14/91/PDF/Morbidi_AUTO13_ExtVer.pdf ↩
Cvetković, Dragoš; Simić, Slobodan K. (2010). "Towards a Spectral Theory of Graphs Based on the Signless Laplacian, III". Applicable Analysis and Discrete Mathematics. 4 (1): 156–166. doi:10.2298/AADM1000001C. ISSN 1452-8630. JSTOR 43671298. https://doi.org/10.2298%2FAADM1000001C ↩
Chaiken, S.; Kleitman, D. (1978). "Matrix Tree Theorems". Journal of Combinatorial Theory, Series A. 24 (3): 377–381. doi:10.1016/0097-3165(78)90067-5. ISSN 0097-3165. /wiki/Daniel_Kleitman ↩
"SciPy". GitHub. 4 October 2023. https://github.com/scipy/scipy/blob/main/scipy/sparse/csgraph/_laplacian.py ↩
"NetworkX". GitHub. 4 October 2023. https://github.com/networkx/networkx/blob/main/networkx/linalg/laplacianmatrix.py ↩
"Julia". GitHub. 4 October 2023. https://github.com/JuliaGraphs/Graphs.jl/blob/0fa5f52856f7f779e8f2ca49bc6cee26e5e19b50/src/linalg/spectral.jl#L78-L88 ↩
"2.3. Clustering". https://scikit-learn.org/stable/modules/clustering.html#spectral-clustering ↩
"PyGSP: Graph Signal Processing in Python". GitHub. 23 March 2022. https://github.com/epfl-lts2/pygsp ↩
"Megaman: Manifold Learning for Millions of Points". GitHub. 14 March 2022. https://github.com/mmp2/megaman ↩
"SmoothG". GitHub. 17 September 2020. https://github.com/LLNL/smoothG ↩
"Announcing Our Paper at KDD 2020". https://complexdatalabmcgill.github.io/papers/post-andy-kdd2020paper/ ↩
"Harshangrjn/LaplacianOpt.jl". GitHub. 2 February 2022. https://github.com/harshangrjn/LaplacianOpt.jl ↩
"LigMG (Large Irregular Graph MultiGrid)-- A distributed memory graph Laplacian solver for large irregular graphs". GitHub. 5 January 2022. https://github.com/ligmg/ligmg ↩
"Laplacians.jl". GitHub. 11 March 2022. https://github.com/danspielman/Laplacians.jl ↩