WhitakerLab / scona

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

Set seed for Erdos Renyi graph in plot degree distribution #130

Closed KirstieJane closed 5 years ago

KirstieJane commented 5 years ago

@wingedRuslan notes in his tutorial that "Note: The Grey Curve (the degree distribution of an Erdos Renyi random graph) will not be exactly the same, because every time you call the plotting function a new Erdos Renyi random graph is created."

I think this is a problem and we should have an option to set the seed for that graph.

By default we don't have to, but I think its important for full reproducibility to be able to make the exact figure again.

wingedRuslan commented 5 years ago

@KirstieJane Thanks for the opening issue about that!

Indeed, the nx.erdos_renyi_graph() has the parameter seed. If we set this parameter to some value (e.g. 10), you will create the same Erdos Renyi graph each time we call plot_degree_dist.

Do you want to have this value hardcoded G_ER = nx.erdos_renyi_graph(nodes, cost, seed=10) or add this parameter seed to our function plot_degree_dist?

KirstieJane commented 5 years ago

I think add the parameter to the plot_degree_dist function, and give it a default value. It would be great to also give the options of passing 'random' for the seed and having the code create a new graph each time.

(But not having random as the default, that would have to be explicitly asked for)

wingedRuslan commented 5 years ago

@KirstieJane, add commit to PR #121 to address this problem. Now by default, we set seed to 10 (just a default integer value) and we are able to make our results reproducible.
In case it is needed to create random Erdos Renyi Graph, set seed to None.

Islast commented 5 years ago

Closing since #121 has been merged, adding this random seed setting functionality