Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm for generating random network

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.

like image 209
416E64726577 Avatar asked Jun 24 '15 19:06

416E64726577


People also ask

What is random network model?

The simplest and oldest network model is the random model, also known as Erdős-Rényi model. According to this model, a network is generated by laying down a number n of nodes and adding edges between them with independent probability p for each node pair.

How do I create a random network?

To construct a random network we follow these steps: 1) Start with N isolated nodes. 2) Select a node pair and generate a random number between 0 and 1. If the number exceeds p, connect the selected node pair with a link, otherwise leave them disconnected.


1 Answers

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

like image 97
David Eisenstat Avatar answered Oct 18 '22 14:10

David Eisenstat