function C = adj2inc ( A ) %ADJ2INC converts adjacency matrix to incidence matrix no_vertices = size(A,1); no_edges = length(find(A)); edge_count = 1; C=zeros(no_vertices,no_edges) for i = 1:no_vertices for j = 1:no_vertices if A(i,j) C(i,edge_count) = -1; C(j,edge_count) = 1; edge_count = edge_count + 1; end end end