资源简介
matlab small_world,用于测算二值化矩阵的小世界属性
代码片段和文件信息
function [SWPdelta_Cdelta_L] = small_world_propensity(A varargin)
% a function for calculating the small world propensity of
% a given network - assumes that matrix is undirected (symmeteric) and if
% not creates a symmetric matrix which is used for the calculations
%NOTE: This code requires the Bioinformatics Toolbox to be installed
% (uses graphallshortestpaths.m)
%Inputs:
% A the connectivity matrix weighted or binary
% varargin a string corresponding to the method of clustering
% to be used where ‘O‘ is Onnela ‘Z‘ is Zhang
% ‘B‘ is Barrat ‘bin‘ is binary (default is Onnela).
% If the user specifies binary analysis a
% weighted matrix will be converted to a binary matrix
% before proceeding.
%
%Outputs:
% SWP the small world propensity of the matrix
% delta_C the fractional deviation from the expected culstering coefficient of a
% random network
% delta_L the fractional deviation from the expected path length of a
% random network
%written by Eric Bridgeford and modified by Sarah F. Muldoon
% Reference: Muldoon Bridgeford and Bassett (2015) “Small-World Propensity in Weighted
% Real-World Networks“ http://arxiv.org/abs/1505.02194
if isempty(varargin)
varargin{1} = ‘O‘;
end
if sum(sum(A)) > 0
bin_matrix = 0;
if strcmp(varargin{1}‘bin‘) == 1
bin_matrix = 1;
A = A > 0;
end
%check to see if matrix is symmeteric
symcheck=abs(A-A‘);
if sum(sum(symcheck)) > 0
% adjust the input matrix to symmeterize
disp(‘Input matrix is not symmetric. Symmetrizing.‘)
W = symm_matrix(A bin_matrix);
else
W=A;
end
%calculate the number of nodes
n = length(W);
%compute the weighted density of the network
dens_net = sum(sum(W))/(max(max(W))*n*(n-1));
%compute the average degree of the unweighted network to give
%the approximate radius
numb_connections = length(find(W>0));
avg_deg_unw = numb_connections/n;
avg_rad_unw = avg_deg_unw/2;
avg_rad_eff = ceil(avg_rad_unw);
%compute the regular and random matrix for the network W
W_reg = regular_matrix_generator(W avg_rad_eff);
W_rand = randomize_matrix(W);
%compute all path length calculations for the network
reg_path = avg_path_matrix(1./W_reg); %path of the regular network
rand_path = avg_path_matrix(1./W_rand); %path of the random netowork
net_path = avg_path_matrix(1./W); %path of the network
A = (net_path - rand_path);
if A < 0
A = 0;
end
diff_path = A/ (reg_path - rand_path);
if net_path == Inf || rand_path == Inf || reg_path == Inf
diff_path = 1;
end
if diff_path > 1
diff_path = 1;
end
%compute all clustering calculations for the network
reg_clus = avg_clus_matrix(W_regvarargin{1});
rand_clus = avg_clus_matrix(W_randvarargin{1});
net_clus = avg_clus_matrix(W
- 上一篇:SOM-TSP[Matlab].rar
- 下一篇:matlab程序补偿色散
相关资源
- matlab程序补偿色散
- SOM-TSP[Matlab].rar
- matlab的逆变电路仿真
- 两机五节点系统的潮流计算
- matlab与ABB机器人建立socket通讯
- 基于MATLAB的血管三维重建源代码
- 样本熵的matlab代码
- 任意旋转矢量到坐标变换矩阵的转换
- 一维二维扩散模型Matlab代码
- pso-bp代码
- 转速负反馈有静差直流调速系统仿真
- 燃料电池极化曲线模型
- 基于matlab的电力拖动自动控制系统F
- Matlab应用技术 在电气工程与自动化专
- [MATLAB]数字图像处理—直方图均衡、直
- Spwm变频调速283895
-
三相全控桥式整流电路simuli
nk仿真 - 单模光纤的场分布
- 粒子群 模拟退火 蚁群算法MATLAB实现
- matlab实现BP神经网络
- MATLAB解决游梁式抽油机.slx
- matlab经纬度距离计算及数据分类合并
- 利用MATLAB计算分形维数
- matlabUDP丢包率及成功概率
- matlab 随机模拟
-
boost单电压换闭环仿真Simuli
nk.slx - SIRP和ZMNL杂波仿真matlab程序
- 车牌识别定位分割matlab
- KPCA算法实现代码,MATLAB
- PCA算法MATLAB实现,附原始数据
评论
共有 条评论