• 大小: 1.98KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-03-28
  • 语言: Matlab
  • 标签: 网络  

资源简介

用matlab编程实现无标度度网络算法

资源截图

代码片段和文件信息

%   This is the BA_Scale Model by Fan Jin.
%   At first there are only m nodes and no edge then the m+1st node is
%   connected with the above m nodes
%   usage: Nodes = BA(Nm)
%   the parameter:N----network size
%                 m----a new node with m new edges
%   can randomly initialize the N and the m by yourself
%   the  diagonal elements of the matrix also equal to -degree
%   Nodes----the final coupling matrix
%   The following message(s) may not be displayed correctly for they contain Chinese charactors.
%   list----生成的一个辅助向量,该向量中的元素为每条边端点的节点。for example 假设网络中节点4的度为7,则在list向量中会存在7个4,而这7个4的位置不一定是连续在一起的。
%   preferential attachment体现在随机的从list向量中选取元素,选中哪个元素,该元素表示的节点即被选中。由于list向量中每个节点的个数与它的度有关,因此,度越大的点被选中的概率越大。
function [NodesCii]=BA(Nm)
% N=10m=3;
Nodes=zeros(N);
Cii=zeros(1N);
t=zeros(1N);
%Nodes=sparse(N);
for i=1:m
    Nodes(im+1)=1;
    Nodes(m+1i)=1;
    A(i)=i;
end
for i=m+1:2*m
    A(i)=m+1;
end
for n=m+2:N   

评论

共有 条评论