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

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

%

I = incidence(G)

% Each column in I represents the source and target nodes of a single edge in G.
% Copyright 2015 The MathWorks, Inc.