bursty_coeff¶
-
bursty_coeff
(data, calc='edge', nodes='all', communities=None, threshold_type=None, threshold_level=None, threshold_params=None)[source]¶ Calculates the bursty coefficient.[1][2]
Parameters: - data (array, dict) – This is either (1) temporal network input with nettype: ‘bu’, ‘bd’. (2) dictionary of ICTs (output of intercontacttimes). (3) temporal network input with nettype: ‘wu’, ‘wd’. If weighted, you must also specify threshold_type and threshold_value which will make it binary.
- calc (str) – Caclulate the bursty coeff over what. Options include ‘edge’: calculate B on all ICTs between node i and j. (Default); ‘node’: caclulate B on all ICTs connected to node i.; ‘communities’: calculate B for each communities (argument communities then required); ‘meanEdgePerNode’: first calculate ICTs between i and j, then take the mean over all j.
- nodes (list or str) – Options: ‘all’: do for all nodes (default) or list of node indexes to calculate.
- communities (array, optional) – None (default) or Nx1 vector of communities assignment. This returns a “centrality” per communities instead of per node.
- threshold_type (str, optional) – If input is weighted. Specify binarizing threshold type. See teneto.utils.binarize
- threshold_level (str, optional) – If input is weighted. Specify binarizing threshold level. See teneto.utils.binarize
- threhsold_params (dict) – If input is weighted. Dictionawy with kwargs for teneto.utils.binarize
Returns: B – Bursty coefficienct per (edge or node measure).
Return type: array
Notes
The burstiness coefficent, B, is defined in refs [1,2] as:
\[B = {{\sigma_{ICT} - \mu_{ICT}} \over {\sigma_{ICT} + \mu_{ICT}}}\]Where \(\sigma_{ICT}\) and \(\mu_{ICT}\) are the standard deviation and mean of the inter-contact times respectively (see teneto.networkmeasures.intercontacttimes)
When B > 0, indicates bursty intercontact times. When B < 0, indicates periodic/tonic intercontact times. When B = 0, indicates random.
Examples
First import all necessary packages
>>> import teneto >>> import numpy as np
Now create 2 temporal network of 2 nodes and 60 time points. The first has periodict edges, repeating every other time-point:
>>> G_periodic = np.zeros([2, 2, 60]) >>> ts_periodic = np.arange(0, 60, 2) >>> G_periodic[:,:,ts_periodic] = 1
The second has a more bursty pattern of edges:
>>> ts_bursty = [1, 8, 9, 32, 33, 34, 39, 40, 50, 51, 52, 55] >>> G_bursty = np.zeros([2, 2, 60]) >>> G_bursty[:,:,ts_bursty] = 1
The two networks look like this:
Now we call bursty_coeff.
>>> B_periodic = teneto.networkmeasures.bursty_coeff(G_periodic) >>> B_periodic array([[nan, -1.], [-1., nan]])
Above we can see that between node 0 and 1, B=-1 (the diagonal is nan). Doing the same for the second example:
>>> B_bursty = teneto.networkmeasures.bursty_coeff(G_bursty) >>> B_bursty array([[ nan, 0.13311003], [0.13311003, nan]])
gives a positive value, indicating the inter-contact times between node 0 and 1 is bursty.
References
[1] Goh, KI & Barabasi, AL (2008) Burstiness and Memory in Complex Systems. EPL (Europhysics Letters), 81: 4 [Link] [2] Holme, P & Saramäki J (2012) Temporal networks. Physics Reports. 519: 3. [Link] (Discrete formulation used here)