Algorithm for generating random network

1.3k views Asked by At

What is the best algorithm to generate a random simple (no parallel edges or self-loops) undirected graph with a given number of nodes, where each node has a number of edges that is no less than min and no greater than max?

For example, if min = 2 and max = 5, I would like a graph where approximately 25% of the nodes have 2 edges, approximately 25% of the nodes have 3 edges, approximately 25% of the nodes have 4 edges, and approximately 25% of the nodes have 5 edges.

1

There are 1 answers

2
David Eisenstat On

You could use random_degree_sequence_graph from NetworkX, which uses an algorithm due to Bayati, Kim, and Saberi.