namhsuya
namhsuya

Reputation: 117

How to create a random graph in networkx from an existing graph?

I want to generate a random graph using the edge distribution from the original graph. Is there a way in networkx module to do that?

Upvotes: 0

Views: 271

Answers (1)

Joel
Joel

Reputation: 23907

I'm assuming you mean same degree distribution.

The command nx.configuration_model(degree_list) will do it.

So in your case, given an existing graph G:

H = nx.configuration_model([G.degree(node) for node in G])

Upvotes: 1

Related Questions