This function generates a non-growing random graph with edge probabilities proportional to node fitness scores.
sample_fitness( no.of.edges, fitness.out, fitness.in = NULL, loops = FALSE, multiple = FALSE )
The number of edges in the generated graph.
A numeric vector containing the fitness of each vertex. For directed graphs, this specifies the out-fitness of each vertex.
If this argument is not
Logical scalar, whether to allow loop edges in the graph.
Logical scalar, whether to allow multiple edges in the graph.
This game generates a directed or undirected random graph where the
probability of an edge between vertices
j depends on the
fitness scores of the two vertices involved. For undirected graphs, each
vertex has a single fitness score. For directed graphs, each vertex has an
out- and an in-fitness, and the probability of an edge from
j depends on the out-fitness of vertex
i and the in-fitness of
The generation process goes as follows. We start from
N is given by the length of the fitness vector). Then we
randomly select two vertices
j, with probabilities
proportional to their fitnesses. (When the generated graph is directed,
i is selected according to the out-fitnesses and
j is selected
according to the in-fitnesses). If the vertices are not connected yet (or if
multiple edges are allowed), we connect them; otherwise we select a new
pair. This is repeated until the desired number of links are created.
It can be shown that the expected degree of each vertex will be
proportional to its fitness, although the actual, observed degree will not
be. If you need to generate a graph with an exact degree sequence, consider
This model is commonly used to generate static scale-free networks. To
achieve this, you have to draw the fitness scores from the desired power-law
distribution. Alternatively, you may use
which generates the fitnesses for you with a given exponent.
An igraph graph, directed or undirected.
Tamas Nepusz email@example.com
Goh K-I, Kahng B, Kim D: Universal behaviour of load distribution in scale-free networks. Phys Rev Lett 87(27):278701, 2001.
Random graph models (games)
N <- 10000 g <- sample_fitness(5 * N, sample((1:50)^-2, N, replace = TRUE)) degree_distribution(g) plot(degree_distribution(g, cumulative = TRUE), log = "xy")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.