lundi 7 décembre 2020

Any shortcut to run this code 1000 times in jupyter-lab/python

I'm learning the networkx module in the jupyter-lab. There is a question which asks me to run a random.sample(G.nodes, 2) code 1000 times and record the length of the shortest path between every two nodes.

My question is: is there any shortcut to conduct this syntax 1000 times and record the length of the shortest path between every two nodes at a time?

Thanks for your help in advance!




Aucun commentaire:

Enregistrer un commentaire