# Thresholding connectivity matrices - graph theory

Dear Mike,

In your book you mention different ways to threshold the connectivity matrices either by median or K. I’ve tried different approaches but went with K strongest connections using the “threshold_proportional” from the Brian Connectivity Toolbox. However, is this the right approach when you have a clear difference in the mean connectivity between the groups?

When creating “random networks” for calculating the normalized cluster coefficients, path length and subsequent small worldiness, there seems to be multiple approaches. What would you suggest?

Furthermore, what would you suggest to do when there is no “surviving” connections for an electrode when thresholding? This usually leads to either NaN of inf values. Currently, I’m removing these from the binary matrix before calculating the different features, see code below.

This type of measure seems kind of sketchy in that you can change the threshold depending on your results. Is there any way around that?

Thanks a lot,

Eric

code:

W = threshold_proportional(Connectivity_matrix,0.3);
W_bin = weight_conversion(W, ‘binarize’);

cc =clustering_coef_bu(W_bin);
cc(cc==0) = [];
C(1,1) = mean(cc);

DL=distance_bin(W_bin);
DL2 = triu(DL);
DL2(DL2==0) = [];
DL2(DL2==inf) = [];
D(1,1) = mean(DL2);

``````for reps = 1:50
[R] = randomizer_bin_und(W_bin,0.5);

cc_rand =clustering_coef_bu(R);
cc_rand(cc_rand==0) = [];
C_rand(reps,1) = mean(cc_rand);

DL_rand=distance_bin(R);
DL2_rand = triu(DL_rand);
DL2_rand(DL2_rand==0) = [];
DL2_rand(DL2_rand==inf) = [];
D_rand(reps,1) = mean(DL2_rand);
end
``````

C_rand_final=mean(C_rand);
D_rand_final=mean(D_rand);

Small_world(ii,1) = (C(1,1)/C_rand_final)/(D(1,1)/D_rand_final);

Hi Eric. Unfortunately, I don’t really know what to tell you here. Electrophysiology connectivity methods in general involve many choices, and graph theory-based methods even more so.

My advice is either to (1) pick one pipeline that seems justified (based on theory or prior data), or (2) try several different pipelines (for example, several different thresholding methods) and report all of them. If you have enough data, you could try a cross-validation approach, where you try various parameters in 1/2 of the data, pick a method that gives nice results, and then apply those same parameters to the other half that your analysis hasn’t seen.

But to your specific questions: I would advise for the threshold over k-strongest. If the two groups have similar spatial patterns of connectivity but differ in strength, then k-strongest would suggest no differences whereas a threshold would reveal the differences. In other words, k-strongest is the right choice when you expect that connectivity patterns differ in topology rather than strength.

If an electrode has no supra-threshold connections, its value can be set to zero. In this case, zero is an interpretable value, not a place-holder like NaN.

Hope that helps! And good luck
Mike