Skip to contents

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.

Usage

sample_pa_age(
  n,
  pa_exp,
  aging_exp,
  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,
  pa.exp = deprecated(),
  aging.exp = deprecated()
)

pa_age(
  n,
  pa_exp,
  aging_exp,
  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,
  pa.exp = deprecated(),
  aging.exp = deprecated()
)

Arguments

n

The number of vertices in the graph.

pa_exp

The preferential attachment exponent, see the details below.

aging_exp

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

m

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.

...

These dots are for future extensions and must be empty.

aging_bin

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

out_dist

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

out_seq

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

out_pref

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

directed

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

zero_deg_appeal

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

zero_age_appeal

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

deg_coef

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

age_coef

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

time_window

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.

pa.exp

[Deprecated] Use pa_exp instead.

aging.exp

[Deprecated] Use aging_exp instead.

Value

A new graph.

Details

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.

barabasi_aging_game(), recent_degree_aging_game()

Author

Gabor Csardi csardi.gabor@gmail.com

Examples


# 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)
max(degree(g1))
#> [1] 193
max(degree(g2))
#> [1] 33
max(degree(g3))
#> [1] 11