I am in the process of calculating the small-world coefficient with NetworkX from Python.

This line of code “small_world_coefficient = nx.algorithms.smallworld.sigma(G, niter=100, nrand=10)” has cost me more than 50 hours for a single subject.

I am just wondering if this is normal to take this long to calculate this indicator.

Your suggestion will be highly appreciated. Thanks for your time and assistance in advance.

Thank you very much for your recommendation and for sharing the command you found helpful.

I’ve reviewed the codes and noted their efficiency. However, they seem to calculate small world coefficient by comparing the real network to one single random network. Considering the randomness in generating a random network, it will inadvertently introduce system bias to this indicator. To address this, nx.algorithms.smallworld.sigma algorithm generates 100 random networks for comparison. Maybe that’s why this processing time is extensive, though more than 50 hours per subject seem unusually prolonged.

Your suggestion inspired me a lot. Motivated by your ideas, I’m planning to modify the codes that you provided to achieve these demands, hopefully. I will keep you in the loop if it works.