function [newNet] = ReNet(a,edges_u_want) %a is the orginal network. Can change the output edges by using edges_u_want
%by Chengwei Lei, UTSA, San Antonio, TX, USA, http://my.cs.utsa.edu/~clei
net=((a+a')>0);
edges=sum(sum(net.*(1-eye(size(net)))))+size(net,1);

if (nargin > 1)
    edges=edges_u_want*2+size(net,1);
end

fullcorr=CorrByRWS(a);
allvalue=sort(fullcorr(:));

newNet=(fullcorr>(allvalue(end-edges)));

