资源简介
计算复杂网络的相关特性,比如,度,平均距离,最短路
代码片段和文件信息
% function r=get_assortative_coefficient(Nodes)
%get assortative coefficientsee Ref[NewmanMixing patterns in networks]
%Input:Nodes--N*N adjacent matrixNodes(ij)=1;i is outdegreej is indegree
%Output:r--assortative coefficient
N=length(Nodes);
edgeNum=nnz(Nodes);%include outEdge and inEdgeave_degree=edgeNum/N
Outdegree=zeros(N1);
Indegree=zeros(N1);
for i=1:N
Outdegree(i)=nnz(Nodes(i:));
Indegree(i)=nnz(Nodes(:i));
end
%sum1 is sum(i*j)
%sum2 is sum(i+j)
%sum3 is sum(i^2+j^2)
sum1=0;
sum2=0;
sum3=0;
[RowColWeight]=find(Nodes);
Len=length(Row);
for temp=1:Len
i=Row(temp);
j=Col(temp);
sum1=sum1+(Indegree(j)-1)*(Outdegree(i)-1);
sum2=sum2+(Indegree(j)-1)+(Outdegree(i)-1);
sum3=sum3+(Indegree(j)-1)^2+(Outdegree(i)-1)^2;
end
%for i=1:N
% for j=1:N
% if Nodes(ij)>0
% sum1=sum1+(Indegree(j)-1)*(Outdegree(i)-1);
% sum2=sum2+(Indegree(j)-1)+(Outdegree(i)-1);
% sum3=sum3+(Indegree(j)-1)^2+(Outdegree(i)-1)^2;
% end
% end
%end
r=((sum1/edgeNum)-(sum2/(2*edgeNum))^2)/((sum3/(2*edgeNum))-(sum2/(2*edgeNum))^2);
return
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1174 2008-07-24 22:47 get_assortative_coefficient.m
----------- --------- ---------- ----- ----
1392 2
- 上一篇:linux tftp rpm软件包
- 下一篇:卡奔安装软件
评论
共有 条评论