% Finds the number of "kmin"-neighbors (k links away at a minimum) for every node % If nodes are k-links away due to loops (so they appear as m-neighbours, m0)]; adjk = adjk*adj; end kneigh = setdiff(find(adjk(ind,:)>0),[close_neighbors ind]);