function AdjMat = EdgeList2AdjMatrix(EdgeList, n)
% AdjMat = EdgeList2AdjMatrix(EdgeList)
%Inputs: EdgeList: a two column matrix giving edge list of a simple graph,
% where the vertices are labelled with positive integers (usual order)
% n = number of vertices
%Output: AdjMat: the corresponding adjacency matrix of the graph

[numE s] = size(EdgeList); %numE = number of number of edges
AdjMat = zeros(n,n); %initialize adjacency matrix--all zero entries

%The following loop changes 0's to 1's for each edge from the edgelist:
for j = 1:numE
    edge = EdgeList(j,:);
    ver1 = edge(1); ver2 = edge(2);
    AdjMat(ver1, ver2) = 1; AdjMat(ver2, ver1) = 1;
end
    
    
        
    