%A adjacency matrix of graph G %n= size of A %find the degree of a vertex v in G %usage d = degree(n,v,A) function d = degree(n,v,A) d=0; for i=1:n, d=d+A(v,i); end;