Graph Laplacian matrix
returns the graph Laplacian matrix,
L = laplacian(
L. Each diagonal entry,
L(j,j), is given by the degree of node
degree(G,j). The off-diagonal entries of
represent the edges in
G such that
L(i,j) = L(j,i) =
-1 if there is an edge between nodes
L(i,j) = L(j,i) = 0. The
G cannot be a multigraph or contain self-loops, and
edge weights are ignored.
Graph Laplacian Matrix
Create a graph using an edge list, and then calculate the graph Laplacian matrix.
s = [1 1 1 1 1]; t = [2 3 4 5 6]; G = graph(s,t); L = laplacian(G)
L = (1,1) 5 (2,1) -1 (3,1) -1 (4,1) -1 (5,1) -1 (6,1) -1 (1,2) -1 (2,2) 1 (1,3) -1 (3,3) 1 (1,4) -1 (4,4) 1 (1,5) -1 (5,5) 1 (1,6) -1 (6,6) 1
The diagonal elements of
L indicate the degree of the nodes, such that
L(j,j) is the degree of node
Calculate the graph incidence matrix,
I, and confirm the relation
L = I*I'.
I = incidence(G); L - I*I'
ans = All zero sparse: 6x6
L — Laplacian matrix
L is a square, symmetric, sparse
matrix of size
graph Laplacian matrix is undefined for graphs with self-loops.