Create a graph using an edge list, and then calculate the graph Laplacian matrix.
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 j
.
Calculate the graph incidence matrix, I
, and confirm the relation L = I*I'
.
ans =
All zero sparse: 6×6