Implementing Barabasi-Albert Method for Creating Scale-Free Networks

半腔热情 提交于 2019-11-30 07:27:47

Okay, so I couldn't figure out how to make this particular algorithm work correctly, instead I used another one.

The Algorithm:
Input: Number of Nodes N; 
       Initial number of nodes m0; 
       Offset Exponent a; 
       Minimum degree 1 <= d <= m0.
Output: scale-free multigraph G = ({0,....,N-1}, E).

1) Add m0 nodes to G.
2) Connect every node in G to every other node in G, i.e. create a complete graph.
3) Create a new node i.
4) Pick a node j uniformly at random from the graph G. Set P = (k(j)/k_tot)^a.
5) Pick a real number R uniformly at random between 0 and 1.
6) If P > R then add j to i's adjacency list.
7) Repeat steps 4 - 6 until i has m nodes in its adjacency list.
8) Add i to the adjacency list of each node in its adjacency list.
9) Add i to to the graph.
10) Repeat steps 3 - 9 until there are N nodes in the graph.

Where k(j) is the degree of node j in the graph G and k_tot is twice the number of edges (the total number of degrees) in the graph G.

By altering the parameter a one can control the exponent of the degree distribution. a = 1.22 gives me an exponent g (in P(k) ~ k^-g) of 3 +/- 0.1.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!