Graph theory measures

Dear experts,

I have created connectomes with tck2connectome. Now, I don’t understand how to derive network measures. Could anyone please explain how to use connectomes that created with tck2connectomes to extract network measures using BCT.
Also, I have a question about results interpretation of connectomestats with NBS and NBSE.
Please help me to figure this out.
Thank you in advance.

Hello,

You can use the bctpy package in Python or the BCT toolbox in MATLAB to derive graph theory measures on the connectome. The BCT websites lists some commonly used measures for brain connectivity, or you can check out their paper. I’ve personally done graph theory analysis using NetworkX in Python.

I’m also just discovering NBS/NBSE, so I can’t be much help there. Perhaps this post may help?

Rafi

Appreciate your suggestions.
Thank you very much.

Best regards,
Rami

Hi all. I came across this question while looking into bctpy and networkx graph metric calculations. I am hoping maybe @RdoubleA could help or provide some insight. I ran the same metric (global efficiency) on an adjacency/connectivity matrix and got vastly different values from bctpy and networkx. This worries me. Any chance you have any insight or have looked into this previously? I haven’t had any luck yet googling what might be causing this difference. (I’m guessing it’s a default setting in the functions because I’ve verified the numpy matrix going into the bctpy function and the networkx graph (G) are the same).

Thanks in advance for any insight you might have here.

I’m not sure if bctpy is actively kept up with and I haven’t had much success with bctpy in the past, so I’m more likely to trust NetworkX and the MATLAB version of BCT. Looking at the code, it seems to be the same algorithm as NetworkX. Which functions were you using exactly? Alternatively, you could calculate characteristic path length and just invert it for global efficiency. Maybe that will give you the same values.

Thank you very much for your quick reply! Yeah, I looked at the code for both functions and the only difference I could see is in how networkx and bctpy deal with inverting. (bctpy uses its invert function, but I got a little lost in the code). Here are the two sets of functions I used:
bctpy: bct.efficiency_wei( Gw , local=False)
networkx: nx.global_efficiency(G)

Both are on undirect, weighted matrices. I’m just really trying to understand the difference in outputs here, because according to the documentation, they should both be the exact same. Oh, and I have not yet tried this with the matlab version of bct because of matlab license issues.

Thank you again for your help.

Ah yes, so according to the documentation for NetworkX the global efficiency function does not use edge weights for computing shortest paths. So in this case I take my previous statement back, I would use bctpy because that function specifically works with weighted graphs. That’s probably why you’re getting a big difference because NetworkX was treating it as binary. Usually you have to feed an additional parameter, weight = ‘weight’ into the NetworkX functions, but I don’t think this one deals with weighted graphs at all.

Hope that helps!

Oh, that makes sense! I missed that (it was a long day of digging into these different scripts). I will probably test it against the binary function, in bctpy just to be sure. Also, just for your knowledge, I got a copy of matlab installed and so far, bctpy appears to give the same results as using bct with matlab. So it looks like there are small differences (like defaulting to binary) I overlooked that were at the core of my discrepant outputs.

Hi,

This is very interesting. I would like to share the experience we had in our lab, maybe somebody could help us to better understand what is going on.

We wanted to compare the global efficiency of two groups (we always use the matlab bct). All matrices have been thresholded to 30% density. The. we calculate the weighted global efficiency and we found signifficant differences going in the opposite dierction as we were expecting. To better understand what was going on, we then binarized the matrices and computed the binary global efficiency, and then the signifficant difference was in the opposite way. This was shocking for me, so I was explaining this to a colleague (mathematician) and he suggested to modify the code and use instead of the standard inversion performed in the global efficiency (1/wij) an exponential one (e^(-wij/(2sigma)), were sigma is the standard deviation of all weights of all subjects. By doing this, the difference appear in the same way as the binary global efficiency. Only changing the normalizarion process change the direction of the findings, and going for binary to weighted change it as well. Any ideas what this happens? Thanks in advance.

Best regards,

Manuel

Any ideas what this happens?

Because “length” is not the antonym of “strength”.

Don’t @ me. :upside_down_face: