The calculation of Small-Worldness

Summary of what happened:

I’d like to calculate global clustering coefficient (CC), characteristic path length (Lp), global efficiency (Eglob), and small-worldness (SW) with the Brain Connectivity Toolbox (BCT).
I have 2 groups, healthy controls and patients. The patient group exhibited lower CC and longer Lp than healthy controls.

If I’m correct, it’s more possible to find the patient group has a lower SW. However, my script calculates higher SW in the patient group (not significant, but the mean values are higher than healthy controls across 3 sparsity levels).

My script calculates the same values for CC, Lp, and Eloc as the GraphVar toolbox.
Even though my script calculates similar SW while using the example data of GraphVar, I can’t make sure the calculation is correct since SW requires the generation of random networks.

I’d like to know if my script is correct.
I would be very appreciative of any suggestions or information.

Command used (and if a helper script was used, a link to the helper script or the command generated):

% load the weighted and undirected networks (a Pearson correlation matrix)
W = CorrMatrix;
% Normalize the matrix
W_nrm = weight_conversion(W, ‘normalize’);
% Apply the sparsity/threhold to filtering out weak connections
W_thr = threshold_proportional(W_nrm,0.2);

% Calculate global CC (Mean_C)
C = clustering_coef_wu(W_thr);
Mean_C = mean(C);

% Calculate global Lp (lambda)
L = weight_conversion(W_thr, ‘lengths’);
[D, B] = distance_wei(L);
lambda = charpath(D,0,0);

% Calculate SW
% Generate 100 random networks
Crand = ;
Lrand = ;
for j = 1:100
W0_thr = null_model_und_sign(W_thr);
% Cluster Coefficient (WU)
C = clustering_coef_wu(W0_thr);
% the average cluster coefficient in the specific sparsity.
Crand(j) = mean(C);
% Chracteristic Path Length
L = weight_conversion(W0_thr, ‘lengths’);
[D, B] = distance_wei(L);
lambda_2 = charpath(D,0,0);
Lrand(j) = lambda_2;
end
% average values to get random CC and random Lp
rCC = mean(Crand);
rLp = mean(Lrand);
% Calculate normalized CC and normalized Lp
nCC = Mean_C/rCC;
nLp = lambda/rLp;
% Small-Worldness
SW = nCC/nLp;

Version:

BCT (2019-3-03)

Environment (Docker, Singularity, custom installation):

MATLAB R2020b