%% Graph Incidence Matrix
% Create a graph using an edge list, and then calculate the graph incidence matrix.

s = [1 1 1 1 1];
t = [2 3 4 5 6];
G = graph(s,t);
I = incidence(G)

%
% Each column in I contains two nonzero entries, which indicate the end nodes of a single edge in G.
% Calculate the graph Laplacian matrix, L, and confirm the relation L = I*I' for undirected graphs.

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

% Copyright 2015 The MathWorks, Inc.