networksns.statistical_models.cdarn_simulation

networksns.statistical_models.cdarn_simulation(p, Q, c, Y, B, n, s, model_cross='neighbors', z_p='uniform')

Simulate a temporal network following the \(CDARN(p)\) model.

The \(CDARN(p)\) model [1] is a generalization of the \(DARN(p)\) model where also cross-correlations between links are taken into account.

For a temporal network described by a time series of adjacency matrices \(\{A_{ij}^t\}_{i,j=1,\ldots, n}^{t=1,\ldots,s}\) the \(CDARN(p)\) model describes the state \(A^{t}_{ij}\) of the link \((i,j)\) at time \(t\) with the following copying mechanism: (i) with probability \(q_{ij}\), the link is copied from a past state of a link in the backbone \(B\) chosen by an assigned probability distribution, (ii) then the lag is selected with probability \(z_i\) with \(i=1,\ldots,p\), where \(p\) represents the order of the memory, (iii) while with probability \(1-q_{ij}\), it is sampled with (marginal) probability \(y_{ij}\).

In other words, the state \(A_{ij}^t\) of the link \((i,j)\) is described by the following stochastic process at discrete time

\(\phantom{aaaaaaaaaaaaaaaaaaa}A^{t}_{ij}= Q^{t}_{ij} A^{t-Z_p^{t}}_{M_{ij}^t} + (1-Q^{t}_{ij}) Y^{t}_{ij}\)

with \(Q_{ij}^t\sim B(q_{ij})\) Bernoulli variable, \(M_{ij}\) random variable picking values between the links in the backbone of \((i,j)\), \(Z_p^t\) is a random variable picking values from \(1\) to \(p\) with probability \(z_i\) \(i=1,\ldots,p\), respectively, and \(Y_{ij}^t\sim B(y_{ij})\) is a Bernoulli variable.

The random variable \(M_{ij}^t\) depends both on the coupling model and the constant \(c\):

  1. Local Cross Correlation (LCC): \(M_{ij}^t\) picks \((i,j)\) with probability \(1-c\) and any other link in the neighbourhood \(\partial B_{ij}\) of \((i,j)\) with probability \(\frac{c}{|\partial B_{ij}|}\).

  2. Uniform Cross Correlation (UCC): \(M_{ij}^t\) picks \((i,j)\) with probability \(1-c\) and any other link in the backbone \(B\) of \((i,j)\) with probability \(\frac{c}{|B-1|}\).

Here \(|\partial B_{ij}|\) and \(|B-1|\) denote the number of links adjacent to \((i,j)\) and the number of links in the backbone different from \((i, j)\), respectively.

Parameters:
  • p (integer) – Markov order

  • Q (array_like) – Symmetric matrix. It represents the link-specific probability of copying from the past. A float input is accepted in the case of homogeneous copying probabilities for each link.

  • c (float) – cross correlation parameter.

  • Y (array_like) – Symmetric matrix. Bernoulli marginal probabilities. A float input is accepted in the case of homogeneous marginal probabilities for each link.

  • B (array_like) – Symmetric matrix. Backbone of the temporal graph.

  • n (integer) – Number of nodes in the graph.

  • s (integer) – Temporal Network sample size, i.e. the length of the time series of adjacency matrices.

  • model_cross (string, optional) – Type of cross correlation. When 'neighbors' links are coupled to all other neighbouring links in the network backbone with equal strength (LCC), when 'all' links are coupled to all other links in the backbone with equal strength (UCC). Default 'neighbors'.

  • z_p (array/string, optional) –

    stochastic array of length \(p\) representing the memory distribution \(Z_p\). Default: 'uniform'. Possible strings:

    • 'uniform': \(Z_p = (\frac{1}{p}, \dots, \frac{1}{p}\)),

    • 'exponential': \(Z_p = \frac{(1, e^{-1}, \dots, e^{-p+1})}{\left|\left|(1, e^{-1}, \dots, e^{-p+1}\right|\right|_2)}\)

    • 'normal': let \(f(x)=\frac{e^{-(x-1)^2/2}}{\sqrt{2\pi}}\) then \(Z_p = \frac{(f(0), \dots, f(p-1))}{\left|\left|(f(0), \dots, f(p-1))\right|\right|}\)

Returns:

simulation: (list) Temporal network produced by a \(CDARN(p)\) model.

Examples

>>>  from networksns import statistical_models as sm
>>>  import numpy as np

Define input parameters

>>>    p = 3
>>>    Q = (np.ones((n, n)) - np.diag(np.ones(n))) * 0.5
>>>    c = 0.4
>>>    Y = (np.ones((n, n)) - np.diag(np.ones(n)))  * 0.3
>>>    B = (np.ones((n, n)) - np.diag(np.ones(n)))
>>>    n = 50
>>>    s = 100

Simulate the temporal network

>>>    time_series = sm.cdarn_simulation(p, Q, c, Y, B, n, s)

References