R igraph manual pages

Use this if you are using igraph from R

sample_pa_age {igraph}R Documentation

Generate an evolving random graph with preferential attachment and aging


This function creates a random graph by simulating its evolution. Each time a new vertex is added it creates a number of links to old vertices and the probability that an old vertex is cited depends on its in-degree (preferential attachment) and age.


  m = NULL,
  aging.bin = 300,
  out.dist = NULL,
  out.seq = NULL,
  out.pref = FALSE,
  directed = TRUE,
  zero.deg.appeal = 1,
  zero.age.appeal = 0,
  deg.coef = 1,
  age.coef = 1,
  time.window = NULL




The number of vertices in the graph.


The preferential attachment exponent, see the details below.


The exponent of the aging, usually a non-positive number, see details below.


The number of edges each new vertex creates (except the very first vertex). This argument is used only if both the out.dist and out.seq arguments are NULL.


The number of bins to use for measuring the age of vertices, see details below.


The discrete distribution to generate the number of edges to add in each time step if out.seq is NULL. See details below.


The number of edges to add in each time step, a vector containing as many elements as the number of vertices. See details below.


Logical constant, whether to include edges not initiated by the vertex as a basis of preferential attachment. See details below.


Logical constant, whether to generate a directed graph. See details below.


The degree-dependent part of the ‘attractiveness’ of the vertices with no adjacent edges. See also details below.


The age-dependent part of the ‘attrativeness’ of the vertices with age zero. It is usually zero, see details below.


The coefficient of the degree-dependent ‘attractiveness’. See details below.


The coefficient of the age-dependent part of the ‘attractiveness’. See details below.


Integer constant, if NULL only adjacent added in the last time.windows time steps are counted as a basis of the preferential attachment. See also details below.


Passed to sample_pa_age.


This is a discrete time step model of a growing graph. We start with a network containing a single vertex (and no edges) in the first time step. Then in each time step (starting with the second) a new vertex is added and it initiates a number of edges to the old vertices in the network. The probability that an old vertex is connected to is proportional to

P[i] \sim (c\cdot k_i^\alpha+a)(d\cdot l_i^\beta+b)


Here k_i is the in-degree of vertex i in the current time step and l_i is the age of vertex i. The age is simply defined as the number of time steps passed since the vertex is added, with the extension that vertex age is divided to be in aging.bin bins.

c, \alpha, a, d, \beta and b are parameters and they can be set via the following arguments: pa.exp (\alpha, mandatory argument), aging.exp (\beta, mandatory argument), zero.deg.appeal (a, optional, the default value is 1), zero.age.appeal (b, optional, the default is 0), deg.coef (c, optional, the default is 1), and age.coef (d, optional, the default is 1).

The number of edges initiated in each time step is governed by the m, out.seq and out.pref parameters. If out.seq is given then it is interpreted as a vector giving the number of edges to be added in each time step. It should be of length n (the number of vertices), and its first element will be ignored. If out.seq is not given (or NULL) and out.dist is given then it will be used as a discrete probability distribution to generate the number of edges. Its first element gives the probability that zero edges are added at a time step, the second element is the probability that one edge is added, etc. (out.seq should contain non-negative numbers, but if they don't sum up to 1, they will be normalized to sum up to 1. This behavior is similar to the prob argument of the sample command.)

By default a directed graph is generated, but it directed is set to FALSE then an undirected is created. Even if an undirected graph is generated k_i denotes only the adjacent edges not initiated by the vertex itself except if out.pref is set to TRUE.

If the time.window argument is given (and not NULL) then k_i means only the adjacent edges added in the previous time.window time steps.

This function might generate graphs with multiple edges.


A new graph.


Gabor Csardi csardi.gabor@gmail.com

See Also

sample_pa, sample_gnp


# The maximum degree for graph with different aging exponents
g1 <- sample_pa_age(10000, pa.exp=1, aging.exp=0, aging.bin=1000)
g2 <- sample_pa_age(10000, pa.exp=1, aging.exp=-1,   aging.bin=1000)
g3 <- sample_pa_age(10000, pa.exp=1, aging.exp=-3,   aging.bin=1000)

[Package igraph version 1.3.3 Index]