Demo entry 6776473

aa

   

Submitted by aa on Dec 03, 2018 at 09:11
Language: Matlab. Code size: 646 Bytes.

%%%%%%%%%%%%%%%%%%%计算节点的平均度
AVR_degree=mean(mean(degree));
G=graph(A);
plot(G)

%%%%%%%%%计算最大连通子图大小
[bins]=conncomp(G,'OutputForm','cell');%由此得到元胞数组
binsizes=zeros(numel(bins),1);
for cell_num=1:numel(bins)
    binsizes(cell_num,1)=numel(bins{cell_num});
end

GCC_size=max(binsizes);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%如此一来计算出最大连通子图大小
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%计算平均路径
dist_of_G=distances(G);
dist_of_G(dist_of_G==inf)=0;
dist_of_G=dist_of_G((dist_of_G~=0));
AVR_L=mean(mean(dist_of_G));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%如此一来计算出平均路径
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%计算直径
Dmt=max(max(dist_of_G));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%如此一来计算出直径

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).