mercredi 19 mai 2021

Random node in an Erdos Renyi network

I'm new to networkx, and I want to extract a random node from the erdos_renyi graph, I'm using this code, but I get an empty list

N = 1000 
p = 0.01 
G = nx.erdos_renyi_graph(N, p)
node = list(random.choice(G.nodes()))



Aucun commentaire:

Enregistrer un commentaire