% make a random graph and look for largest
% component
 % make a random graph
   tic
   figure; hold on; grid on;
   %for n=[10,50,100,500,1000,5000,10000]
   % for n=2.^[4:14]
     n=10000;
      iter=1;
      prob = (1/n)*[0:.2:4];
      L=length(prob);
      comp=zeros(L,1);
      for s=1:L
         p=prob(s); 
         for  t=1:iter
            G=make_rand_graph2(n,p);
            [count,sizes]=find_comps_nopics(G);
            % add size of largest comp
            comp(s)=comp(s)+max(sizes);
         end % for t
         % compute averate of largest sizes
         comp(s)=comp(s)/(n*iter);
      end % for s 
      [n,toc]
      plot(n*prob,comp);
      title('Growth of the giant component in a random graph')
      xlabel('average vertex degree = p n')
      ylabel('component size as fraction of n')
      legend('n=16','n=32','n=64','n=128','n=256','n=512',...
       'n=1024','n=2048','n=4096','n=8192','n=16384','n=32768');
      drawnow;
   %end % for n
   toc
 
