WhitakerLab / scona

Code to analyse structural covariance brain networks using python.
https://whitakerlab.github.io/scona/
MIT License
68 stars 33 forks source link

Include small world in plot_network_measures #131

Open KirstieJane opened 5 years ago

KirstieJane commented 5 years ago

At the moment plot_network_measures only includes assortativity, clustering, shortest path length, efficiency and modularity.

It really should also include the small world coefficient.

On thing that's important to note is that the small world coefficient is calculated for the real graph compared to each of the random graphs.

This means that - in comparison to the other measures - the variability will be on the "blue" bars - the bars representing the real graphs - rather than the grey ones (the random graphs).

That bar should be set to exactly 1.

The command: bundleGraphs.report_small_world("real_graph") returns a dictionary with keys real_graph_R0, real_graph_R1, real_graph_R2 etc. These correspond to the comparison of the graph labelled "real_graph" with R0 (itself), R1, R2 etc.


Another thing to note is that I don't think the small world measures are saved as part of the graph bundle after they've been calculated. It might be interesting to see if we can make it so you only have to run it once (similar to making random graphs etc).

(This might be better as its own issue, just shout if that's the case.)

wingedRuslan commented 5 years ago

@KirstieJane I would like to add this measure while I am creating a function to restructure DataFrame obtained from GraphBundle.report_global_measures() to an acceptable DataFrame for seaborn.barplot.

I've run the GraphBundle.report_small_world. Did I understand the results correctly?

image

I am calculating the small coefficient of "Real_Graph" in GraphBundle relative to each other Graph in GraphBundle. So, the small coefficient for "Real_Graph" and "Real_Graph_R0" is 1.6565, for "Real_Graph" and "Real_Graph_R1" is 1.6507 and so on.

On the figure, I need to display eror bar for "Real_Graph" and for random networks - constant value 1.

wingedRuslan commented 5 years ago

@KirstieJane, I've added small_world to network measures Do you like it?

image

wingedRuslan commented 5 years ago

Ohhhh, plotting is slow, because inside the function I calculate the small coefficient of "real_graph" relative to each other graph in GraphBundle.
small_world = bundleGraphs.report_small_world(real_network)

It is needed to find a way how to store the calculated small world values and then inside the function simply access this data.