scale-free network help
Show older comments
Hello; I have a homework about scale-free network. I must write a matlab program for scale-free network with matlab. There are many ready programmes in the internet. I try to write a programme by heliping ready programme and I add some codes. But I don't understand exactly the algorithm. My programme:
%clc N=100; % network size m_ilk_b_d_s=3; % initial node number adj=zeros(N,N); for i= 1: m_ilk_b_d_s adj( i, m_ilk_b_d_s-1) = 1; adj( m_ilk_b_d_s-1, i) = 1; end k =zeros (N,1) ; for i = 1:m_i_b_d_s k( i ) = (sum(adj ( i , : ) )+sum(adj (: , i ) ) ) ; end while m_i_b_d_s < N m_i_b_d_s = m_i_b_d_s + 1; for i = 1:m_i_b_d_s − 1 P = k( i ) /sum(k) ; %Preferential attachment i f (rand (1,1) < P k( i ) = k( i ) + 2; % Why add these 2? k(m) = k(m) + 2; adj ( i ,m_i_b_d_s) = 1; adj (m_i_b_d_s, i ) = 1; end% i f end;% for end;% while m return
Can anyone help me description. Thanks......The program also must find:
(N:network size, k: link number)
*path length L=ln N/ln<k>
*clustering coefficint C=<k>/N
*gamma(γ) P(k) ~ k-γ
Answers (0)
Categories
Find more on Networks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!