## Abstract

Human social interactions tend to vary in intensity over time, whether they are in person or online. Variable rates of interaction in structured populations can be described by networks with the time-varying activity of links and nodes. One of the key statistics to summarize temporal patterns is the inter-event time, namely the duration between successive pairwise interactions. Empirical studies have found inter-event time distributions that are heavy-tailed, for both physical and digitalÂ interactions. But it is difficult to construct theoretical models of time-varying activity on a network that reproduce the burstiness seen in empirical data. Here we develop a spanning-tree method to construct temporal networks and activity patterns with bursty behavior. Our method ensures any desired target inter-event time distributions for individual nodes and links, provided the distributions fulfill a consistency condition, regardless of whether the underlying topology is static or time-varying. We show that this model can reproduce burstiness found in empirical datasets, and so it may serve as a basis for studying dynamic processes in real-world bursty interactions.

### Similar content being viewed by others

## Introduction

Temporal networks have been recognized as a powerful tool to model complex systems with time-varying interactions^{1,2,3}. A large body of literature concentrates on analyzing the activation dynamics of nodes and links in such networks. The inter-event time (the waiting time between two consecutive interaction events, IET) is a canonical measure of temporal patterns, and it is known to have profound effects on individual behavior^{4,5,6,7} and dynamical processes occurring on networks^{8,9,10,11,12}. A variety of empirical datasets, such as email and mobile communications^{13,14,15}, epidemic transmission^{16,17,18}, and human mobility^{19,20}, exhibit non-Poisson activity patterns, known as burstiness^{4,21,22}. These IET patterns are characterized by periods of frequent activation interleaved with long periods of silence. Empirical networks often exhibit burstiness in both the activity of individuals (nodes) as well as interactions (edges)^{23,24,25}.

It has proven difficult to construct synthetic temporal networks whose properties are similar to the bursty behavior seen in empirical temporal networks^{26}. Previous approaches can be divided into two categories: structure-based modeling, and contact-based modeling. The former approach applies dynamical processes to static underlying topologies, such as random walks^{27,28}, link dynamics^{29}, and inhomogeneous Poisson processes^{30}. For example, Barrat et al. used random itineraries on weighted underlying networks to generate time-extended structures with bursty behavior^{28}. The latter approach uses a stream of contacts generated by certain realistic mechanisms, such as social appeal^{31}, individual resource^{32}, and memory^{33}. For example, Perra et al. proposed the activity-driven model^{34}, in which each node, isolated in the beginning, becomes active with a probability proportional to its own activity potential and forms links with other nodes. Several related models have been proposed based on the activity-driven framework^{35,36}. Despite a large body of studies in constructing temporal networks, they usually fail to reproduce the same level of burstiness as empirical datasets, and they lack mathematical guarantees for the behavior of the synthetic network. These goals require a model to generate bursty behavior simultaneously in the activity of both nodes and links, while the level of burstiness in nodes and links is allowed to be easily modified in a reasonable parameter space.

In this study, we provide an analytical framework to systematically construct temporal networks on both static and time-varying underlying topologies. Our construction algorithm can reproduce the burstiness of both nodes and edges in four empirical datasets, including social interactions in rural Malawi, colleague relationships in an office building over two years, and friendship relations in a high school. The assumptions of our model can also be tested in the empirical datasets. Our construction thus serves as an efficient method to generate realistic temporal networks that can then be used to investigate dynamical processes (such as evolutionary dynamics, social contagion, or epidemics) on temporal networks.

Our approach to constructing temporal networks uses a spanning-tree method. Spanning trees are widely recognized as an important family of sparse sub-graphs since they tend to govern dynamical processes on full graphs^{37,38,39,40}. For example, in social networks, the backbone of an aggregated communication topology is often constructed as the union of shortest-path spanning trees, on which information flows fastest^{39}. As a result, a large portion of directed edges are bypassed by faster indirect routes in the tree. In studies of food webs^{40}, spanning trees are defined as the flows from the environment to every species. The links in or out of the tree are denoted as â€˜strongâ€™ or â€˜weakâ€™ links, related to delivery efficiency or system robustness and stability.

## Results

We introduce a spanning-tree method for constructing temporal networks on any underlying topology, which restricts the interaction pattern between pairs of individuals. The activity of every single node and link is a binary-state process, switching between active and inactive. We use inter-event time (IET) distribution, which measures the time intervals between consecutive activations, to quantify the activity patterns of nodes and edges.

Our method allows for both static and time-varying underlying topologies. The underlying topology represents physical limitations on pairwise interactions, where an interaction between two individuals is possible only when there is a link between them in the underlying topology. Here we first consider static underlying topologies, in which the activation dynamics on a given topology is much faster than the evolution of the underlying topologies, such as the time-varying traffic flow on a relatively stable road network. We consider three classes of topologies in order of increasing complexity: two-node topologies, tree topologies, and finally arbitrary structured topologies. After studying static topologies, we will subsequently consider cases when the underlying topology itself also changes over time.

### Two-node systems

We begin with a basic unit of a networked system â€“ a two-node system, which is composed of nodes *x* and *y* and a link *z* between them (see Fig.Â 1a). The nodes and edges are either active or inactive at each discrete time step. We assume that the state updating of *x* follows a renewal process \({\{{X}_{n}\}}_{n\ge 0}\) and assigns *x* a probability mass function *F*(Î”*t*) as its target IET distribution (seeÂ Supplementary Information sectionÂ 1). The random variable *X*_{n} equals 1 if *x* is active at time *n*, otherwise *X*_{n}â€‰=â€‰0. Likewise for node *y* and edge *z*, which have respective target IET distributions *G*(Î”*t*) and *H*(Î”*t*), and respective renewal processes \({\{{Y}_{n}\}}_{n\ge 0}\) and \({\{{Z}_{n}\}}_{n\ge 0}\). The initial state of *x*, *y*, *z* is active (i.e., *X*_{0}â€‰=â€‰*Y*_{0}â€‰=â€‰*Z*_{0}â€‰=â€‰1). The goal is to construct a two-node temporal network that satisfies the target IET distributions of *x*, *y*, and *z*.

By definition, we say that edge *z* is active when *x*, *y* are both active (i.e., *Z*_{n}â€‰=â€‰*X*_{n}*Y*_{n}). Furthermore, we assume that, given the trajectory of *x* until *n*, the probability of *x* being active at time *n*â€‰+â€‰1 is independent of the trajectory of *y* until *n*, that is,

where **X**^{(n)} is a random vector of length *n*â€‰+â€‰1, equal to \({({X}_{0},{X}_{1},...,{X}_{n})}^{{{{{{{{\rm{T}}}}}}}}}\). The vector **X**^{(n)} records the whole history of states of *x* through time *n*, and so does **Y**^{(n)}. Given these assumptions, we can show that when all targeted distributions are identical (i.e., *F*â€‰=â€‰*G*â€‰=â€‰*H*) the system must be completely synchronous, that is, all of *x*, *y*, *z* are either active or inactive at each time step (seeÂ Supplementary Information sectionÂ 2).

Given the state of the first *n* times (from time 0 to *n*â€‰âˆ’â€‰1), the conditional probability that node *x* is active at time *n* is given by

where \({{{{{{{{\bf{w}}}}}}}}}_{x}^{(n-1)}={({w}_{x}^{(0)},...,{w}_{x}^{(n-1)})}^{{{{{{{{\rm{T}}}}}}}}}\in {\{0,1\}}^{n}\) records all historical states of node *x* before time *n*, called *x*â€™s trajectory, and \(m=\max \{k\le n:w_x^{(k)}=1\}\) represents the last activation time of *x*. Analogous conditional probabilities apply to *y* and *z*, and it is straightforward to show that each element of \({{{{{{{{\bf{w}}}}}}}}}_{z}^{(n-1)}\) equals the product of the corresponding elements of \({{{{{{{{\bf{w}}}}}}}}}_{x}^{(n-1)}\) and \({{{{{{{{\bf{w}}}}}}}}}_{y}^{(n-1)}\).

We propose an algorithm to construct two-node temporal networks such that the IET distributions of *x*, *y*, *z* will match the desired targeted distributions *F*, *G*, *H* and the desired total time duration *t*_{tol}. At each time step *t*â€‰=â€‰*n*â€‰+â€‰1 (0â€‰â‰¤â€‰*n*â€‰â‰¤â€‰*t*_{tol}â€‰âˆ’â€‰1), we calculate four probabilities with Eq. (2),

These four probabilities represent the conditional probabilities for the four possible states of nodes *x* and *y*, given the previous states of nodes *x* and *y* (i.e., \({{{{{{{{\bf{w}}}}}}}}}_{x}^{(n-1)}\) and \({{{{{{{{\bf{w}}}}}}}}}_{y}^{(n-1)}\)). Specifically, *p*_{1} represents the probability that edge *z* is active at time *t*â€‰=â€‰*n*â€‰+â€‰1; *p*_{2} (or *p*_{3}) represents the probability that *z*, *y* are inactive but *x* is active; *p*_{3} represents the probability that *z*, *x* are inactive but *y* is active; and *p*_{4} represents the probability that *x*, *y*, *z* are all inactive at time *t*. Next, we determine the state of *x* and *y* at *t*, in order. The probability that *x* is active is \({p}_{x}({{{{{{{{\bf{w}}}}}}}}}_{x}^{(n)},1)\). If *x* is active, the probability of *y* being active is \({p}_{1}/{p}_{x}({{{{{{{{\bf{w}}}}}}}}}_{x}^{(n)},1)\). Otherwise, the probability becomes \({p}_{3}/(1-{p}_{x}({{{{{{{{\bf{w}}}}}}}}}_{x}^{(n)},1))\). Finally, we update the trajectory of *z* by the relation \({w}_{z}^{(t)}={w}_{x}^{(t)}{w}_{y}^{(t)}\). The construction stops when *t*â€‰=â€‰*t*_{tol}. AlgorithmÂ 1 inÂ Supplementary Information outlines the above procedure. It is worth noting that the activation order of *x* and *y* does not affect the IET distributions of *x*, *y*, *z*.

Although the algorithm is specified for an arbitrary combination of target IET distributions (*F*, *G*, *H*), these distributions must satisfy an implicit condition in order to guarantee the consistency of the construction. For example, if the target distributions specify that the link *z* is activated more frequently than the nodes *x* and *y*, then no construction is possible, because the link is active only when both nodes are active. This would result in at least one of the probabilities *p*_{i} (*i*â€‰=â€‰1, 2, 3, 4) in Eq. (3) being less than 0 during the construction. We say that the combination (*F*, *G*, *H*) of target distributions is consistent if *p*_{i} (*i*â€‰=â€‰1, 2, 3, 4) belong to [0, 1] for all possible trajectories \({{{{{{{{\bf{w}}}}}}}}}_{x}^{(n)}\) and \({{{{{{{{\bf{w}}}}}}}}}_{y}^{(n)}\) with any length *n*. When a two-node system is consistent, the algorithm is well-defined, and it ensures that the IET distributions of *x*, *y*, *z* will satisfy the targets *F*, *G*, *H*, respectively (seeÂ Supplementary Information sectionÂ 2).

### Tree systems

The construction for two-node systems can be naturally extended to tree systems, which consist of a number of interconnected two-node systems (Fig.Â 1b). We randomly select a node as the root *r* and classify the remaining nodes (i.e., leaves) according to their distance from *r*. We choose a desired target IET distribution for each node and link. At each time step, we first determine the state of *r*, which is only related to its own trajectory. Then, every leaf one step away from *r* (*a*1 and *a*2 in Fig.Â 1b) forms a two-node system with *r*, and the states of these leaves are determined by Algorithm 1. Next, all leaves one step away from *r* form two-node systems with their corresponding leaves two steps away from *r* [(*a*1, *b*1) and (*a*2, *b*2) in Fig.Â 1b]. Analogously, the states of all leaves are updated within a two-node system in order of their distance from *r*. AlgorithmÂ 2 inÂ Supplementary Information summarizes this procedure.

This procedure requires an additional assumption of conditional independence â€“ that for a pair of two-node systems sharing a node, if the state of the common node is given then the activity of the other two nodes is independent. As shown in Fig.Â 1b, we present two examples, (*r*, *a*1, *a*2) and (*r*, *a*1, *b*1), fulfilling this condition. The former indicates that the activity of nodes with the same distance from *r* (i.e., *a*1, *a*2) is independent given the state of their common node (i.e., *r*), which is closer to the root. The latter indicates that the activity of a node (i.e., *b*1) is not affected by the node that is more than one step away (i.e., *r*), given the state of the intervening node (i.e., *a*1).

It is straightforward to show that a tree system is consistent if all two-node systems in the tree are consistent. When a tree system is consistent, the IET distribution of every single node/link generated by this construction is guaranteed to match its corresponding target distribution (seeÂ Supplementary Information sectionÂ 2).

### Spanning-tree based construction

For any static (but arbitrary) underlying topology, we can always find a spanning tree (Fig.Â 1c). A link is called a trunk if it is in the spanning tree, and it is called a branch otherwise. In our construction, we first randomly select a spanning tree and the root of the tree, and then choose a target IET distribution for each node and trunk. Next, we execute Algorithm 2 on the spanning tree, so that all nodes and trunks will update their states to achieve the targeted IETs. The state of each branch is then active when the nodes on both ends are active. As a result, the activity of the entire system is determined by its spanning tree. AlgorithmÂ 3 inÂ Supplementary Information summarizes this procedure. We say that the system is consistent when its spanning tree system is consistent.

### Synthetic temporal networks

To test our algorithm, we construct temporal networks with one of two activity patternsâ€”bursty activity patterns and Poisson activity patterns. Bursty patterns arise when there is a simultaneous bursty activity in node and links activity, and Poisson pattern arises in settings such as bank queuing systems^{41} and spreading dynamics^{42}. In particular, we choose target IET distributions of nodes and trunks that are power-law distributions for bursty activity patterns, given by

And we choose discrete exponential distributions for Poisson-like activity patterns, given by

where Î”*t* represents the inter-event time and *Î±* the exponent. The respective survival functions are given as

with exponent *Î±*â€‰âˆ’â€‰1 and

with exponent *Î±*.

In the main text, we focus on a simple case when all nodes (trunks) have a common exponent *Î±*_{pmf} (*Î²*_{pmf}), and we use the aggregated IET distribution^{21,22,23}, which counts the IETs of all nodes or links, to quantify the intensity of activity. InÂ Supplementary Information, we also consider the IET distributions of every single node and link (Supplementary Fig.Â 1) and we investigate the relationship with the aggregated IET distributions. We also explore a more general case in which the exponents of nodes and trunks are sampled independently from a distribution (Supplementary Fig.Â 2).

We begin our analysis by constructing temporal networks with bursty activity patterns. We derive a necessary and sufficient condition for system consistency, which applies to any network length *t*_{tol} (see Methods Eq. (14) and Supplementary Information for details). As examples, we consider two pairs of exponent setups, (*Î±*_{pmf}, *Î²*_{pmf})â€‰=â€‰(2.00, 1.90) and (*Î±*_{pmf}, *Î²*_{pmf})â€‰=â€‰(1.80, 1.30), and we execute Algorithm 3 over two classes of static underlying topologies, BarabÃ¡si-Albert scale-free networks^{43} and Watts-Strogatz small-world networks^{44}. FigureÂ 2a shows the aggregated IET distributions of nodes and links. For both underlying topologies and both parameter setups, the probability mass functions \({\mathbb{P}}({{\Delta }}t)\) and the corresponding survival functions \({\mathbb{P}}(T > \, {{\Delta }}t)\) are well fit by power-law distributions, showing simultaneous burstiness in nodes and links. The best-fit exponent for nodes matches the exponent of the target IET distribution, and the exponent for links is slightly lower than the target exponent, due to the impact of branches (edges outside the spanning tree, where the algorithm is guaranteed to work).

Next, we construct temporal networks with Poisson-like activity patterns. If the target distributions for nodes and trunks are Poisson distributions, then we can prove that the system is never consistent (seeÂ Supplementary Information sectionÂ 2). However, it is possible to construct consistent systems when the target IET follows discrete exponential distributions. In this case, we derive a necessary and sufficient condition for system consistencyâ€”namely, that the difference of *Î±*_{pmf} and *Î²*_{pmf} lies in \([0,\ln 2]\), meaning that the activity of nodes must be more frequent than links but not too frequent (see Methods and Supplementary Information for details). FigureÂ 2b shows the aggregated IET distributions along with the exponents of the target distributions (*Î±*_{pmf}, *Î²*_{pmf})â€‰=â€‰(2.50, 2.00) and (1.80, 1.30). All the distributions follow the expected exponential decay.

Comparing the results for the two topologies, we find that the exponents produced by the algorithmic construction are sensitive to the choice of target IET distribution, but are stable to the choice of network topology. To examine this observation more generally, we investigated a wide range of random regular underlying topologies with different average degrees, ranging from 5 to the well-mixed case (i.e., each node linked to all other nodes, see Supplementary Figs.Â 3 and 4). We find that we can robustly match target IET distributions across all these topologies: the relative deviation between the largest and smallest exponent in algorithmically constructed networks is within 4%.

We can understand why the algorithmic construction for producing a desired IET distribution is not significantly dependent on topology by analyzing the activity of branches. In particular, we prove that the IET distribution of every single branch is approximately a power-law distribution (respectively a discrete exponential distribution) in bursty activity patterns (respectively Poisson-like activity patterns) with uniform upper and lower bounds related only to the target distributions (seeÂ Supplementary Information sectionÂ 3). This is also why the performance of our method is stable with respect to the choice of spanning tree (Supplementary Fig.Â 5).

### Empirical temporal networks

We tested the ability of our algorithm to reproduce the burstiness of activity patterns observed in four empirical datasets, collected by the SocioPatterns collaboration. These four datasets record pairs of face-to-face interactions from different social contexts, ranging from a village in rural Malawi, to an office building and a high school in France. Each dataset is comprised of contact events with timestamps, represented by triplets (*t*, *i*, *j*)â€”indicating the occurrence of an interaction between individual *i* and individual *j* at time *t*.

It is worth noting that the empirical data record only the communication moments, so that only the active nodes with at least one active neighbor can be detected. In other words, the empirical data are observations of the inter-communication times (ICTs), rather than the IETs of nodes. Nevertheless, we demonstrate that the ICT distribution of single nodes converges exponentially to the IET distribution as the number of neighbors on the underlying topology increases (seeÂ Supplementary Information sectionÂ 4). Since empirical datasets often originate from highly connected populations, the ICT distributions approximate the statistical properties of the corresponding IET distributions.

Before applying our algorithm, we first test whether the assumptions underlying the algorithmic construction are consistent with the empirical datasets. The assumption that the activity of nodes and links is a renewal process is reasonable, compared to the empirical data (Supplementary Fig.Â 6). However, the strong form of the conditional independence (Eq. (1)) assumed by our construction is rejected for the empirical data (Supplementary Fig.Â 7). Nonetheless, the empirical data satisfy a weaker form of conditional independence (Supplementary Fig.Â 8, seeÂ Supplementary Information sectionÂ 5 for details).

After pre-processing the datasets (see Methods), we obtain four empirical temporal networks with population sizes ranging from *N*â€‰=â€‰84 to *N*â€‰=â€‰327 and length from *t*_{tol}â€‰=â€‰7, 375 to *t*_{tol}â€‰=â€‰43, 436 time-steps. For all of these temporal networks, the empirical ICT distributions of nodes and links both exhibit heavy tails, with different decay rates, showing simultaneous burstiness in activity. We fit these empirical ICTs with power-law distribution (Eq. (4)) by maximum likelihood estimation^{45,46}, and we use the fitted distributions as targets for constructing synthetic temporal networks. FigureÂ 3 shows the comparison between the empirical and algorithmically constructed ICT distributions of nodes and links. Our algorithm successfully replicates the qualitative patterns of burstiness observed in empirical datasets. Supplementary Fig.Â 9 shows the comparison between the IET and ICT distributions of nodes. Since the average degree of these empirical underlying topologies is large, the IET distribution collapses onto the ICT distribution.

### Combination with network evolution

Although some underlying topologies are static, a variety of real-world systems also exhibit topology changes over timescales that are comparable to the activation dynamics on the network. For example, in online social networks, new users can enter the network and engage in new interactions with existing users; or users can switch between online and offline states. As a consequence, temporal changes in activity originate not only from the states of existing nodes and links, but also from the addition and subtraction of nodes and links in the underlying structure. In these cases, the underlying topology (i.e., physical limitations on interactions) is no longer static, but time-varying.

With this as a backdrop, we extend our algorithm from static to dynamic underlying topologies, starting first with networks that grow in size. We introduce a new model that combines our algorithm for constructing temporal networks with the BarabÃ¡si-Albert model^{43}, which we call the temporal BarabÃ¡si-Albert model. The construction process is as follows. An underlying topology is initialized with *m*_{0} nodes, and the spanning tree is selected randomly. At each time step, the activity state of the existing network updates once with Algorithm 3, then one adds a new node with *m*â€‰â‰¤â€‰*m*_{0} links connected to *m* different existing nodes following the preferential attachment rule^{43}. All the newly added elements are set to be active, and the states of the older pre-existing elements are updated accordingly. The spanning tree is then updated by adding the new node and a link randomly selected from *m* new links. At some time point, the underlying topology stops growing, and the construction process continues with *g*â€‰â‰¥â€‰0 more steps on the final state of the underlying topology. FigureÂ 4a shows a schematic illustration of the above procedure. FigureÂ 4b shows numerical simulations of the temporal BarabÃ¡si-Albert model in bursty and Poisson-like activity patterns. We find that the IET distributions of nodes and links are stable with respect to the duration time *g*, which means that the activity pattern is established during the evolution of the underlying topology, and it is then preserved after the topology is fixed.

Aside from overall growth in system size, some systems change underlying topologies without increasing in size, but rather by changes in the links between individuals, even if the total number of links is stable over time. We show that our model is also applicable in this case (see Supplementary Figs.Â 10 and 11). In addition to changing the location of edges, nodes, and links may also be removed over time, due to aging or other recessionary impacts, which is a counterpart of system growth; a straightforward example is the reverse process of the temporal BarabÃ¡si-Albert model.

To model these various kinds of network evolution, we have developed a more general procedure for constructing temporal networks on time-varying underlying topologies (seeÂ Supplementary Information AlgorithmÂ 4). The key to this algorithm is to update the spanning tree in accordance with the evolution of the underlying topology.

### Topology of aggregated static networks

In addition to bursty in inter-event times, real-world temporal networks exhibit several other characteristic and distinguishing features^{28,47}. One important feature, distinct from the IET distribution, is the topology of the weighted network generated by integrating snapshots of activity over time. In particular, we can consider the weighted network produced by aggregating active nodes and edges from time *t*â€‰=â€‰1 to time *t*â€‰=â€‰*t*_{agg} (Fig.Â 5a). The aggregated network is weighted, and we characterize its topology by considering the distribution of weighted node degree, which is a generalization of the node degree distribution.

Our algorithm for constructing a temporal network with desired IET distributions also can reproduce the stationary property of the associated weighted node degree distribution. In particular, if the node degree distribution of the (unweighted) static underlying topology follows *d*(*x*), and if all links have the same activity pattern specified by parameter *Î²*, then for a sufficiently large aggregation time *t*_{agg} we can prove that the weighted node degree distribution produced by our algorithm will satisfy

Here *v*(*Î²*) is a function of the parameter *Î²* that governs activity patterns (seeÂ Supplementary Information sectionÂ 7 for detailed derivations). Equation (8) shows that, when the underlying topology is a scale-free network (i.e., *d*(*x*) follows a power-law distribution), then \({p}_{{t}_{agg}}(x)\) will also follow a power-law distribution with the same exponent as *d*(*x*), regardless of the aggregation duration *t*_{agg}. FigureÂ 5b shows an example of this general mathematical result in the case of a BarabÃ¡si-Albert scale-free underlying topology.

For an arbitrary (unweighted) node degree distribution *d*(*x*), we can still find a normalization method such that the aggregated distribution is insensitive to the duration *t*_{agg}. The normalization proceeds as follows: First, an aggregated network of aggregation time *t*_{base} is selected as the baseline. Then for any aggregated network of aggregation time *t*_{agg}â€‰>â€‰*t*_{base}, we multiply *t*_{base}/*t*_{agg} by each node strength. When *t*_{base} is sufficiently large, the normalized survival function for any *t*_{agg}â€‰>â€‰*t*_{base} will collapse onto the survival function for *t*_{base} (seeÂ Supplementary Information sectionÂ 7 for detailed derivations). We have verified this result on a network with a small-world topology (Fig.Â 5c).

Finally, we have applied this normalization procedure to the aggregated activity patterns of the four empirical datasets shown in Fig.Â 3. This analysis verifies that our construction of temporal networks to match empirical IET distributions also matches the stationary property of the weighted node degree in empirical data (Supplementary Fig.Â 12).

## Discussion

Simple models that neglect temporal variation in individual behavior do not suffice to describe the dynamics of many real-life complex systems. A large and growing body of studies suggestÂ that state switching of individuals and interactions plays a significant role in diverse dynamical processes, such as face-to-face communication^{25}, evolutionary dynamics^{12,48}, and network control^{49}. We have proposed an analytical framework and corresponding spanning-tree method to construct temporal networks with specific activity patterns, including bursty and Poisson-like activity patterns. Unlike prior constructions of temporal networks in the literature^{5,35,36}, our algorithm is able to reproduce the simultaneous burstiness of both nodes and edges observed in empirical datasets, from diverse social contexts (Supplementary Fig.Â 13).

The central ingredient in our construction algorithmâ€”the spanning treeâ€”has been widely recognized as a significant feature in both theoretical^{50,51,52} and real-world applications of network science^{53}. For example, in path-finding algorithms such as Dijkstraâ€™s algorithm^{54} and the A* search algorithm^{55}, the shortest paths from a given source node to all other nodes, together with the source node, form a shortest-path tree. These algorithms are widely used in mobile robot covering problems^{56}, for tracking the establishment of oil pipelines^{57}, and for vehicle routing^{58}. The tree structure is the backbone of these networked systems. Other examples include telecommunication networks, including the Internet, where the Spanning Tree Protocol^{59} and Augmented tree-based routing^{60} are used to avoid routing loops, to solve the scalability problem, and gain resilience against node failure and link instability. In social networks, spanning tree-based algorithms have been proven effective in detecting communities, one of the most widely studied issues in network science^{61}. Thus our spanning tree-based method for generating specific activity patterns might have implications in several areas of application, which remain to be investigated.

Our analysis of activity patterns on different underlying topologies shows that the algorithmic IET distribution of nodes or edges does not significantly depend on the underlying topology, for a given spanning tree. This result indicates that the macroscopic activity pattern of a general network can be largely determined by the dynamics of its key components, such as its spanning tree. Branches from the spanning tree will cause only small perturbations to the activity pattern, regardless of their number and location, akin to the effects of â€™weak linksâ€™ in food webs^{40}. As a result, we can construct a temporal network with a desired consistent activity pattern, even if the underlying topology is not precisely known, or even changing in time.

Another straightforward way to measure the burstiness and memory of temporal networks is to calculate the burstiness parameter^{26} and the auto-correlation function (seeÂ Supplementary Information sectionÂ 8). A larger burstiness parameter means a higher level of burstiness, and a lower absolute value of the auto-correlation function means a weaker dependence on memory. Our results show that our synthetic bursty activity patterns have strong auto-correlation and a positive and high burstiness parameter, while the Poisson-like activity patterns are memoryless and have a negative burstiness parameter (Supplementary TablesÂ 1 and 2, Supplementary Fig.Â 14).

The past ten years have shown increasing interest in understanding the effects of group interactions and higher-order interactions^{62,63,64,65,66}, meaning behavioral activities that are not limited to just pairs of individuals. A recent study has shown that higher-order interactions in empirical datasets display similar bursty behaviors to pairwise interactions^{67}. And so a natural extension of this work is to study the activity of higher-order interactions in temporal networks. Our approach may provide a method to decompose networks into several elementary components, analogs of spanning trees in the context of hyper-graphs, which remains a direction for future research on the temporal dynamics in groups of interacting agents.

## Methods

### Mathematical formalization

Here we provide a mathematical model of the two-node temporal network construction, which is a stochastic process \({\{{S}_{m}\}}_{m\ge 0}\) coupling the activity of every unit. Complete mathematical details about the existence of \({\{{S}_{m}\}}_{m\ge 0}\) and the modeling of other systems are provided in theÂ Supplementary Information.

We follow the notation in the Two-node systems section. According to the constraint *Z*_{n}â€‰=â€‰*X*_{n}*Y*_{n}, we construct a stochastic process \({\{{S}_{m}\}}_{m\ge 0}\), which for arbitrary sets of \({t}_{1},...,{t}_{k}\in {\mathbb{N}},k\in {{\mathbb{Z}}}^{+}\) satisfies

and *S*_{0}â€‰=â€‰*S*_{1}â€‰=â€‰1. Here \({\mu }_{{X}_{{t}_{1}},...,{X}_{{t}_{k}}}\) represents the finite dimensional distribution of \({\{{S}_{m}\}}_{m\ge 0}\) at the time slice (*t*_{1},...,*t*_{k}). \({\{{S}_{m}\}}_{m\ge 0}\) can be viewed as composing of the following sequence

and *Z*_{n}â€‰=â€‰*S*_{2n}*S*_{2n+1}. \({\{{S}_{m}\}}_{m\ge 0}\) follows the activation order in the main text (i.e., the state of *x* is determined first). If we exchange the order, the corresponding indexes in Eq. (9) and the sequence of *X*_{n} and *Y*_{n} in Eq. (10) are also swapped.

### System consistency

The consistency of the two-node system is equivalent to the existence of \({\{{S}_{m}\}}_{m\ge 0}\). If \({\{{S}_{m}\}}_{m\ge 0}\) is well-defined, the algorithmically produced IET distributions of *x*, *y*, *z* will satisfy the target distributions *F*, *G*, *H*.

We derive the equivalence of the consistency condition for bursty and Poisson-like activity patterns in a two-node system. Let \({p}_{x}^{(n)}={p}_{x}({{{{{{{{\bf{0}}}}}}}}}^{(n-1)},1)\) denote the conditional probability that *x* is active for the first time at *n*, where

is a trajectory with length *m* and only one active state occurring at the initial time. For a power-law distribution with exponent *Î±*,

and for a discrete exponential distribution with exponent *Î±*,

From the definition of the distribution consistency, the equivalence is given as

for bursty activity patterns and

for Poisson-like activity patterns. Note that these consistency conditions ensure that the algorithm works for any length *t*_{tol}.

### Construction of empirical temporal networks

We generate an unweighted underlying topology \({{{{{{{\mathcal{S}}}}}}}}\) and a temporal network \({{{{{{{\mathcal{T}}}}}}}}\) for each empirical dataset. We first determine the length of \({{{{{{{\mathcal{T}}}}}}}}\) by counting the number of timestamps in the dataset. Then, the snapshot at time *t* is formed by all contact events with the corresponding timestamps. Finally, we obtain \({{{{{{{\mathcal{S}}}}}}}}\) by aggregating all snapshots, that is, link (*i*, *j*) exists on \({{{{{{{\mathcal{S}}}}}}}}\) if individuals *i* and *j* interact at least once.

## Data availability

All the empirical datasets used in this paper are freely and publicly available at http://www.sociopatterns.org.

## Code availability

Code has been deposited into the publicly available GitHub repository at https://github.com/anzhisheng/Temporal-networks-by-spanning-trees^{68}.

## References

Holme, P. & SaramÃ¤ki, J. Temporal networks.

*Phys. Rep.***519**, 97â€“125 (2012).Holme, P. Modern temporal network theory: a colloquium.

*Eur. Phys. J. B***88**, 1â€“30 (2015).Masuda, N., Lambiotte, R. A guide to temporal networks (World Scientific, 2016).

Karsai, M. et al. Bursty human dynamics (Springer, 2018).

Karsai, M., Kaski, K., BarabÃ¡si, A.-L. & KertÃ©sz, J. Universal features of correlated bursty behaviour.

*Sci. Rep.***2**, 1â€“7 (2012).Gernat, T. et al. Automated monitoring of behavior reveals bursty interaction patterns and rapid spreading dynamics in honeybee social networks.

*Proc. Natl. Acad. Sci. USA***115**, 1433â€“1438 (2018).Choi, S. H. et al. Individual variations lead to universal and cross-species patterns of social behavior.

*Proc. Natl. Acad. Sci. USA***117**, 31754â€“31759 (2020).Karsai, M. et al. Small but slow world: How network topology and burstiness slow down spreading.

*Physical Review E***83**, 025102 (2011).Jo, H.-H., Perotti, J. I., Kaski, K. & KertÃ©sz, J. Analytically solvable model of spreading dynamics with non-Poissonian processes.

*Physical Review X***4**, 011041 (2014).Lambiotte, R., Tabourier, L. & Delvenne, J.-C. Burstiness and spreading on temporal networks.

*The European Physical Journal B***86**, 1â€“4 (2013).Mancastroppa, M., Vezzani, A., MuÃ±oz, M. A. & Burioni, R. Burstiness in activity-driven networks and the epidemic threshold.

*Journal of Statistical Mechanics: Theory and Experiment***2019**, 053502 (2019).Li, A. et al. Evolution of cooperation on temporal networks.

*Nat. Commun.***11**, 1â€“9 (2020).Onnela, J.-P. et al. Structure and tie strengths in mobile communication networks.

*Proc. Natl. Acad. Sci. USA***104**, 7332â€“7336 (2007).Malmgren, R. D., Stouffer, D. B., Motter, A. E. & Amaral, L. A. N. A Poissonian explanation for heavy tails in e-mail communication.

*Proc. Natl. Acad. Sci. USA***105**, 18153â€“18158 (2008).Malmgren, R. D., Stouffer, D. B., Campanharo, A. S. L. O. & Amaral, L. A. N. On universality in human correspondence activity.

*Science***325**, 1696â€“1700 (2009).Vazquez, A. Polynomial growth in branching processes with diverging reproductive number.

*Phys. Rev. Lett.***96**, 038702 (2006).Vazquez, A., Racz, B., Lukacs, A. & Barabasi, A.-L. Impact of non-Poissonian activity patterns on spreading processes.

*Phys. Rev. Lett.***98**, 158702 (2007).Unicomb, S., IÃ±iguez, G., Gleeson, J. P. & Karsai, M. Dynamics of cascades on burstiness-controlled temporal networks.

*Nat. Commun.***12**, 1â€“10 (2021).Song, C., Koren, T., Wang, P. & BarabÃ¡si, A.-L. Modelling the scaling properties of human mobility.

*Nat. Phys.***6**, 818â€“823 (2010).SchlÃ¤pfer, M. et al. The universal visitation law of human mobility.

*Nature***593**, 522â€“527 (2021).Barabasi, A.-L. The origin of bursts and heavy tails in human dynamics.

*Nature***435**, 207â€“211 (2005).VÃ¡zquez, A. et al. Modeling bursts and heavy tails in human dynamics.

*Phys. Rev. E***73**, 036127 (2006).Karsai, M., Kaski, K. & KertÃ©sz, J. Correlated dynamics in egocentric communication networks.

*PLoS One***7**, e40612 (2012).SaramÃ¤ki, J. & Moro, E. From seconds to months: an overview of multi-scale dynamics of mobile telephone calls.

*The European Physical Journal B***88**, 1â€“10 (2015).GÃ©nois, M. & Barrat, A. Can co-location be used as a proxy for face-to-face contacts?

*EPJ Data Sci.***7**, 1â€“18 (2018).Goh, K.-I. & BarabÃ¡si, A.-L. Burstiness and memory in complex systems.

*Europhys. Lett.***81**, 48002 (2008).Starnini, M., Baronchelli, A., Barrat, A. & Pastor-Satorras, R. Random walks on temporal networks.

*Phys. Rev. E***85**, 056115 (2012).Barrat, A., Fernandez, B., Lin, K. K. & Young, L.-S. Modeling temporal networks using random itineraries.

*Phys. Rev. Lett.***110**, 158702 (2013).Holme, P. Epidemiologically optimal static networks from temporal network data.

*PLoS Comput. Biol.***9**, e1003142 (2013).Hiraoka, T., Masuda, N., Li, A. & Jo, H.-H. Modeling temporal networks with bursty activity patterns of nodes and links.

*Phys. Rev. Res.***2**, 023073 (2020).Starnini, M., Baronchelli, A. & Pastor-Satorras, R. Modeling human dynamics of face-to-face interaction networks.

*Phys. Rev. Lett.***110**, 168701 (2013).Aoki, T., Rocha, L. E. C. & Gross, T. Temporal and structural heterogeneities emerging in adaptive temporal networks.

*Phys. Rev. E***93**, 040301 (2016).Vestergaard, C. L., GÃ©nois, M. & Barrat, A. How memory generates heterogeneous dynamics in temporal networks.

*Phys. Rev. E***90**, 042805 (2014).Perra, N., GonÃ§alves, B., Pastor-Satorras, R. & Vespignani, A. Activity driven modeling of time varying networks.

*Sci. Rep.***2**, 1â€“7 (2012).Ubaldi, E., Vezzani, A., Karsai, M., Perra, N. & Burioni, R. Burstiness and tie activation strategies in time-varying social networks.

*Sci. Rep.***7**, 46225 (2017).Le Bail, D., GÃ©nois, M. & Barrat, A. Modeling framework unifying contact and social networks.

*Phys. Rev. E***107**, 024301 (2023).Newman, C. M. & Stein, D. L. Spin-glass model with dimension-dependent ground state multiplicity.

*Phys. Rev. Lett.***72**, 2286 (1994).BarabÃ¡si, A.-L. Invasion percolation and global optimization.

*Phys. Rev. Lett.***76**, 3750 (1996).Kossinets, G., Kleinberg, J., Watts, D., The structure of information pathways in a social communication network.

*In*: Proceedings of the 14th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 435â€“443 (2008).Garlaschelli, D., Caldarelli, G. & Pietronero, L. Universal scaling relations in food webs.

*Nature***423**, 165â€“168 (2003).Ross, S. M. et al. Stochastic processes (Wiley New York, 1996).

BarthÃ©lemy, M., Barrat, A., Pastor-Satorras, R. & Vespignani, A. Velocity and hierarchical spread of epidemic outbreaks in scale-free networks.

*Phys. Rev. Lett.***92**, 178701 (2004).BarabÃ¡si, A.-L. & Albert, R. Emergence of scaling in random networks.

*Science***286**, 509â€“512 (1999).Watts, D. J. & Strogatz, S. H. Collective dynamics of â€™small-worldâ€™ networks.

*Nature***393**, 440â€“442 (1998).Clauset, A., Shalizi, C. R. & Newman, M. E. J. Power-law distributions in empirical data.

*SIAM Rev.***51**, 661â€“703 (2009).Alstott, J., Bullmore, E. & Plenz, D. powerlaw: a Python package for analysis of heavy-tailed distributions.

*PLoS One***9**, e85777 (2014).Gautreau, A., Barrat, A. & BarthÃ©lemy, M. Microdynamics in stationary complex networks.

*Proc. Natl. Acad. Sci. USA***106**, 8847â€“8852 (2009).Sheng, A., Li, A. & Wang, L. Evolutionary dynamics on sequential temporal networks.

*PLoS Comput. Biol.***19**, e1011333 (2023).Li, A., Cornelius, S. P., Liu, Y.-Y., Wang, L. & BarabÃ¡si, A.-L. The fundamental advantages of temporal networks.

*Science***358**, 1042â€“1046 (2017).Wang, X., Wang, X. & Wilkes, D. M. A divide-and-conquer approach for minimum spanning tree-based clustering.

*IEEE Trans. Knowl. Data Eng.***21**, 945â€“958 (2009).Xiao, F. & Wang, L. State consensus for multi-agent systems with switching topologies and time-varying delays.

*Int. J. Control***79**, 1277â€“1284 (2006).Xiao, F. & Wang, L. Asynchronous consensus in continuous-time multi-agent systems with switching topology and time-varying delays.

*IEEE Trans. Automat. Contr.***53**, 1804â€“1816 (2008).Parsakhoo, A. & Jajouzadeh, M. Determining an optimal path for forest road construction using Dijkstraâ€™s algorithm.

*J. For. Sci.***62**, 264â€“268 (2016).Dijkstra, E. W. A note on two problems in connexion with graphs.

*Numer. Math.***1**, 269â€“271 (1959).Hart, P. E., Nilsson, N. J. & Raphael, B. A formal basis for the heuristic determination of minimum cost paths.

*IEEE Trans. Syst. Man. Cybern.***4**, 100â€“107 (1968).Gabriely, Y. & Rimon, E. Spanning-tree based coverage of continuous areas by a mobile robot.

*Ann. Math. Artif. Intell.***31**, 77â€“98 (2001).Baeza, D., Ihle, C. F. & Ortiz, J. M. A comparison between ACO and Dijkstra algorithms for optimal ore concentrate pipeline routing.

*J. Clean. Prod.***144**, 149â€“160 (2017).Imran, A., Salhi, S. & Wassan, N. A. A variable neighborhood-based heuristic for the heterogeneous fleet vehicle routing problem.

*Eur. J. Oper. Res.***197**, 509â€“518 (2009).Braem, B., Latre, B., Moerman, I., Blondia, C., Demeester, P. The wireless autonomous spanning tree protocol for multihop wireless body area networks.

*In*: 2006 Third Annual International Conference on Mobile and Ubiquitous Systems: Networking & Services, 1â€“8 (2006).Caleffi, M., Ferraiuolo, G., Paura, L. Augmented tree-based routing protocol for scalable ad hoc networks.

*In*: 2007 IEEE International Conference on Mobile Adhoc and Sensor Systems, 1â€“6 (2007).Basuchowdhuri, P., Anand, S., Srivastava, D. R., Mishra, K. & Saha, S. K. Detection of communities in social networks using spanning tree.

*Adv. Comput. Netw. Inform.***2**, 589â€“597 (2014).Mayfield, M. M. & Stouffer, D. B. Higher-order interactions capture unexplained complexity in diverse communities.

*Nat. Ecol. Evol.***1**, 1â€“7 (2017).Paul, S., Haldar, S., von Malottki, S. & Heinze, S. Role of higher-order exchange interactions for skyrmion stability.

*Nat. Commun.***11**, 1â€“12 (2020).Battiston, F. et al. The physics of higher-order interactions in complex systems.

*Nat. Phys.***17**, 1093â€“1098 (2021).Alvarez-Rodriguez, U. et al. Evolutionary dynamics of higher-order interactions in social networks.

*Nat. Hum. Behav.***5**, 586â€“595 (2021).Lambiotte, R., Rosvall, M. & Scholtes, I. From networks to optimal higher-order models of complex systems.

*Nat. Phys.***15**, 313â€“320 (2019).Cencetti, G., Battiston, F., Lepri, B. & Karsai, M. Temporal properties of higher-order interactions in social networks.

*Sci. Rep.***11**, 1â€“10 (2021).Sheng, A., Su, Q., Li, A., Wang, L. & Plotkin, J. B. Constructing temporal networks with bursty activity patterns.

*Temporal-networks-by-spanning-trees***10**, 5281 (2023).Ozella, L. et al. Using wearable proximity sensors to characterize social contact patterns in a village of rural Malawi.

*EPJ Data Sci.***10**, 46 (2021).GÃ©nois, M. et al. Data on face-to-face contacts in an office building suggest a low-cost vaccination strategy based on community linkers.

*Netw. Sci.***3**, 326â€“347 (2015).Mastrandrea, R., Fournet, J. & Barrat, A. Contact patterns in a high school: a comparison between data collected using wearable sensors, contact diaries and friendship surveys.

*PLoS One***10**, e0136497 (2015).

## Acknowledgements

A.S. acknowledges support from the China Scholarship Council (no. 202206010147). A.L. and L.W. acknowledge support from the National Key Research and Development Program of China (no. 2022YFA1008400), National Natural Science Foundation of China (no. 62036002 and 62173004), and the Beijing Nova Program (Z211100002121105). Q.S. acknowledges support from Shanghai Pujiang Program (no. 23PJ1405500).Â J.B.P. acknowledges support from the John Templeton Foundation (grant number 62281).

## Author information

### Authors and Affiliations

### Contributions

Conceptualization: A.S., A.L., L.W., and J.B.P.; Methodology: A.S.; Analysis and interpretation of data: A.S., Q.S., A.L., L.W., and J.B.P.; Writing the manuscript: A.S., Q.S., A.L., L.W., and J.B.P.

### Corresponding authors

## Ethics declarations

### Competing interests

The authors declare no competing interests.

## Peer review

### Peer review information

*Nature Communications* thanks the anonymous reviewers for their contribution to the peer review of this work. A peer review file is available.

## Additional information

**Publisherâ€™s note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Supplementary information

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the articleâ€™s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the articleâ€™s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Sheng, A., Su, Q., Li, A. *et al.* Constructing temporal networks with bursty activity patterns.
*Nat Commun* **14**, 7311 (2023). https://doi.org/10.1038/s41467-023-42868-1

Received:

Accepted:

Published:

DOI: https://doi.org/10.1038/s41467-023-42868-1

## Comments

By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.