91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 11KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-18
  • 語(yǔ)言: Matlab
  • 標(biāo)簽: matlab??small_world??

資源簡(jiǎn)介

matlab small_world,用于測(cè)算二值化矩陣的小世界屬性

資源截圖

代碼片段和文件信息

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?????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

評(píng)論

共有 條評(píng)論