NetLogo / NW-Extension

This is the NetLogo Network Extension. For general information about NetLogo, see:
http://ccl.northwestern.edu/netlogo/
Other
62 stars 25 forks source link

Add configuration model generation #130

Open qiemem opened 10 years ago

qiemem commented 10 years ago

The configuration model takes a specified degree distribution and generates a random network with that exact degree distribution. It works as follows: give each node i k_i link stubs, where a k_i is the degree assigned to node i and a link stub is simply a link with only one end connected. Connect the link stubs to each other uniformly at random. This can result in networks with multiple links between nodes and self-loops. If any appear, just reshuffle the connections.

The nice thing about the configuration model is that it's so flexible. Generating a regular network becomes one line:

nw:generate-configuration n-values 100 [ 5 ]

Arbitrary scale-free networks can be generated like so:

nw:generate-configuration n-values 100 [ round (50 * (? + 1) ^ -1) ]

This is partially inspired by this SO question: http://stackoverflow.com/questions/25332514/assigning-neighbors-to-agents-in-symmetric-manner

qiemem commented 9 years ago

A few things to decide on this:

qiemem commented 9 years ago

For the second two points, I realized there's a deterministic way to realize these networks:

  1. Sort nodes by degree (highest degree first): v_1, v_2, ..., v_n
  2. Iterate down the list so that each node connects with as many nodes as it needs to below itself in the list, skipping any that are full.

If there's a network that realizes the degree distribution, this will realize it.

Then, we can attempt to swap links to randomize. So, we grab two random links and attempt to swap the end of one with an end other the other. Make a bunch of such attempts (some number times the number of links).

I believe this will at least approach a uniform pull from the set of networks with that degree distribution as the number of attempted swaps approaches infinity. Unfortunately, since we can't perform an infinite number of attempted swaps, it will be a different distribution. I'm also not sure if you can work yourself into a network where you can't make any swaps but other realizations exist.

I'm leaning towards implementing this, and then including netlogo code to do actual, guaranteed uniform sampling from the set of realizations for people for whom that's an absolute requirement.