Use this if you are using igraph from R
sample_fitness_pl {igraph}  R Documentation 
This function generates a nongrowing random graph with expected powerlaw degree distributions.
sample_fitness_pl(
no.of.nodes,
no.of.edges,
exponent.out,
exponent.in = 1,
loops = FALSE,
multiple = FALSE,
finite.size.correction = TRUE
)
no.of.nodes 
The number of vertices in the generated graph. 
no.of.edges 
The number of edges in the generated graph. 
exponent.out 
Numeric scalar, the power law exponent of the degree
distribution. For directed graphs, this specifies the exponent of the
outdegree distribution. It must be greater than or equal to 2. If you pass

exponent.in 
Numeric scalar. If negative, the generated graph will be undirected. If greater than or equal to 2, this argument specifies the exponent of the indegree distribution. If nonnegative but less than 2, an error will be generated. 
loops 
Logical scalar, whether to allow loop edges in the generated graph. 
multiple 
Logical scalar, whether to allow multiple edges in the generated graph. 
finite.size.correction 
Logical scalar, whether to use the proposed finite size correction of Cho et al., see references below. 
This game generates a directed or undirected random graph where the degrees of vertices follow powerlaw distributions with prescribed exponents. For directed graphs, the exponents of the in and outdegree distributions may be specified separately.
The game simply uses sample_fitness
with appropriately
constructed fitness vectors. In particular, the fitness of vertex i
is
i^{alpha}
, where alpha = 1/(gamma1)
and gamma is
the exponent given in the arguments.
To remove correlations between in and outdegrees in case of directed
graphs, the infitness vector will be shuffled after it has been set up and
before sample_fitness
is called.
Note that significant finite size effects may be observed for exponents
smaller than 3 in the original formulation of the game. This function
provides an argument that lets you remove the finite size effects by
assuming that the fitness of vertex i
is
(i+i_01)^{alpha}
where i_0
is a
constant chosen appropriately to ensure that the maximum degree is less than
the square root of the number of edges times the average degree; see the
paper of Chung and Lu, and Cho et al for more details.
An igraph graph, directed or undirected.
Tamas Nepusz ntamas@gmail.com
Goh KI, Kahng B, Kim D: Universal behaviour of load distribution in scalefree networks. Phys Rev Lett 87(27):278701, 2001.
Chung F and Lu L: Connected components in a random graph with given degree sequences. Annals of Combinatorics 6, 125145, 2002.
Cho YS, Kim JS, Park J, Kahng B, Kim D: Percolation transitions in scalefree networks under the Achlioptas process. Phys Rev Lett 103:135702, 2009.
g < sample_fitness_pl(10000, 30000, 2.2, 2.3)
## Not run: plot(degree_distribution(g, cumulative=TRUE, mode="out"), log="xy")