# sample_pa_age

##### 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.

- Keywords
- graphs

##### 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_age(...)

##### Arguments

- n
The number of vertices in the graph.

- pa.exp
The preferantial 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.- 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 constant, whether to include edges not initiated by the vertex as a basis of preferential attachment. See details below.

- directed
Logical constant, 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.- ...
Passed to

`sample_pa_age`

.

##### 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)\cdot $$

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
generaed \(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.

##### Value

A new graph.

##### See Also

##### Examples

```
# NOT RUN {
# 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))
max(degree(g2))
max(degree(g3))
# }
```

*Documentation reproduced from package igraph, version 1.2.4.1, License: GPL (>= 2)*