%% 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)

%
% 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'.

I = incidence(G);
L - I*I'

% Copyright 2015 The MathWorks, Inc.