Dynamic network analysis, i.e. analysis of networks that change over time, is currently one of the most active topics of research in network science and theory. A common task in this field is to use our prior knowledge of the network link dynamics to answer questions about the behavior of the network over time, e.g. how quickly information can flow through it. Many modern real-life networks are dynamic in nature, in the sense that the network structure undergoes discrete changes over time [30, 36]. Here we deal with the discrete-time dynamicity of the network links (edges) over a fixed set of nodes (vertices). That is, given an underlying static graph , the network evolution over is given by the successive appearance or absence of each edge of at every time step . This concept of dynamic network evolution is given by temporal graphs [26, 28], which are also known by other names such as evolving graphs [5, 19], or time-varying graphs . For a recent attempt to integrate existing models, concepts, and results from the distributed computing perspective, see the survey papers [11, 12] and the references therein.
Definition 1 (Temporal graph).
Given an underlying static graph on vertices and edges, a temporal graph on is a sequence of graphs such that for all . Every is the snapshot of at time step .
Another way to think about temporal graphs is by assigning time-labels on the edges; for example, if an edge appears in the snapshots , , and , then we equivalently assign to the set of labels . Due to the vast applicability of temporal graphs, various structural and algorithmic properties of them have been studied extensively, both via theoretical/algorithmic analysis and via empirical simulation-based analysis. In many of these works, one of the central temporal notions is that of a temporal path. A path in the underlying (static) graph is a temporal path (or journey) if there exists an increasing sequence of time-labels as one walks along the edges of the path [26, 28]. Motivated by the fact that, due to causality, information in temporal graphs can only flow along sequences of edges that appear in an increasing time order, many temporal graph parameters and optimization problems that have been studied so far are based on the notion of a temporal path and other related notions, e.g. temporal analogs of distance, diameter, connectivity, reachability, and exploration [3, 2, 22, 33, 9, 7, 13, 18, 20, 6, 27, 17]. In addition to temporal paths, recently also various temporal non-path problems have been introduced and algorithmically studied, such as temporal vertex cover , temporal coloring , and temporal -cliques [41, 23].
Apart from the focus on the various algorithmic problems that one can study on temporal graphs, one can also view temporal graphs through several different levels of knowledge about the actual network evolution. On the one extreme, we may be given the whole temporal graph instance in advance, i.e. the times of appearance and absence of every edge at all times, as it typically happens e.g. when modeling transportation networks. On the other extreme, the temporal graph may be created by an adversary who reveals it to us snapshot-by-snapshot at every time step. Here we focus on the intermediate knowledge settings, captured by stochastic temporal graphs, where the network evolution is given by a probability distribution that governs the appearance of each edge over time.
Definition 2 (Stochastic temporal graph).
A stochastic temporal graph is a stochastic process whose random variables are snapshots of an underlying graph . Every instantiation of is a temporal graph.
A natural feature of stochastic temporal graphs which can be observed in various real-life scenarios (and which we address in this paper) is that the appearance probability of a particular edge at a given time step depends on the appearance (or absence) of the same edge at the previous time steps. This “memory effect” can often be observed, among others, in faulty network communication and in mobile, social, and peer-to-peer networks [14, 37, 34]. Several other models of temporal networks which exhibit some sort of probabilistic behavior have been considered in the past, see e.g. .
In this paper, we study a hierarchy of models for stochastic temporal graphs. These models concern an edge-centric network evolution, i.e. they assign to every edge of the underlying graph a probability distribution for its appearance over time, independently of all the other edges. The first and most basic model (memoryless or memory-) assigns independently to every edge a probability such that, at every time step, appears with probability . In the general model (memory-), at every time step the appearance probability of every edge is a function of the history of its appearances/absences in the last time steps. Clearly, for every , the memory- model is a special case of the memory- model. However, in this paper we make a clear distinction between the values (“no memory”) and (“some memory”), as in some cases these models exhibit a fundamentally different computational behavior for these values of , as our results indicate (see Section 4).
Our memory- model, , is a direct generalization of the homogeneous version of the memory-1 model that was introduced in a seminal paper by Clementi et al. , in which all edges have the same probability distribution for their appearance, based on their own appearance/absence at the previous step. In this homogeneous memory-1 model, Clementi et al. gave upper bounds for the flooding time and they provided tight characterizations of the graphs on which the flooding time is constant . It is worth noting here that Avin et al.  studied the completely opposite extreme of our edge-centric evolution; namely they considered a graph-centric evolution model where a global probability distribution assigns specific transition probabilities among different snapshots . Between the two extremes of the edge-centric and the graph-centric network evolution models, there exists a whole hierarchy of locally interdependent probabilistic patterns, i.e. probability distributions where the appearance probability of one edge also depends on the appearance of other edges over time; such models remain mostly unexplored.
In both our memoryless and memory- variations of stochastic temporal graphs, we study two fundamental temporal path (i.e. journey) problems that are defined on two designated vertices and . Consider a piece of information that is generated at at time 1, which we would like to send to via an - journey. The arrival time of an - journey in a realization of a stochastic temporal graph is the time the information reaches using this journey. A foremost - journey is one with the smallest arrival time. In the first part of the paper we investigate the complexity of computing the expected arrival time of a foremost - journey. Basu et al.  and Nain et al.  studied a similar problem but their work is restricted to the simpler cases where the underlying graph is either a path or a grid.
In the second part of the paper we investigate the complexity of computing the arrival time of a best policy for actually choosing a particular - journey in the stochastic temporal graph. To illustrate this notion of a best policy, assume that some piece of information is carried by an entity, say Alice. Alice is given as input the parameters of the stochastic temporal graph (i.e. the probabilistic rules on the edges) and, at every time step, she knows the current snapshot and her current location. Based on this information, Alice has to decide at every step for her next action, while her goal is to reach as quickly as possible on expectation, starting at time 1. In a very inspiring paper, Basu et al.  consider this problem in the special case of the memoryless model where all edges have the same probability of appearance at every time, and give a Dijkstra-like polynomial-time algorithm. Special cases of the memory-1 model were considered in .
To illustrate the difference between the two problems we study, we make the following analogy. In the first problem (Minimum Arrival) we try to transfer information from to using an unbounded number of messages, i.e. we “flood” the stochastic temporal graph with information. Initially the information is stored at at time 1 and then, at every step, every informed vertex informs all its neighbors as soon as the edge between them becomes available. In the second problem (Best Policy) we try to transfer a package with a tangible good from to . Now, at every step we need to decide for the actual route of the package through the network: when an edge appears, should we ship the package along it or rather wait where we currently are? Best Policy is more relevant to real-life applications than Minimum Arrival, where an actual good journey needs to be found in real time.
Our contribution. In the first part of the paper, in Section 3, we provide our results for the problem Minimum Arrival, i.e. for computing the expected arrival time of a foremost - journey in a stochastic temporal graph. First we prove in Section 3.1 that Minimum Arrival is #P-hard even for the memoryless model (and thus also for the memory- model, for every ). The reduction is done from the problem #PP2DNF which counts the number of satisfying assignments in a positive partitioned 2-DNF Boolean formula .
Second, we provide in Section 3.2 a non-trivial approximation scheme for Minimum Arrival, based on dynamic programming, for the memoryless model in the case where the underlying graph is a series-parallel graph. More specifically, it turns out that this is a Fully Polynomial-Time Approximation Scheme (FPTAS) whenever the probabilities are lower bounded by for some . Let be the random variable that expresses the arrival time of a foremost - journey. For every , our FPTAS gives an algorithm that produces a value where , and runs in polynomial time in both and . Although our main result of Section 3.2 concerns series-parallel graphs, we actually present a more general FPTAS approach (see Theorem 3) which is of independent interest and could lead to FPTASs also for more general classes of underlying graphs .
Third, we present in Section 3.3 a Fully Polynomial Randomized Approximation Scheme (FPRAS) for Minimum Arrival in the memory- model, for every , under the assumption that every edge appearance probability is lower bounded by for some . Let be the random variable that expresses the arrival time of a foremost - journey. For every
, our FPRAS gives a randomized algorithm that produces an estimatewhere with probability tending to 1 as , and runs in polynomial time in both and .
In the second part of the paper, in Section 4, we provide our results for the problem Best Policy, i.e. for computing the expected arrival time of a best policy for choosing a particular - journey. Initially we provide in Section 4.1 a dynamic programming algorithm for the memoryless model which runs in time and space. In wide contrast, we prove in Section 4.2 that Best Policy becomes #P-hard for the memory- model, where , again by providing a reduction from the problem #PP2DNF. Finally, we provide in Section 4.3 a formulation of Best Policy in the memory- model using the general Markov Decision Process (MDP) framework which allows us to devise in Section 4.3.2 an exact doubly exponential-time algorithm with running time .
In this paper we consider temporal graphs (see Definition 1) in which the underlying (static) graph has vertices and edges. A subgraph of , denoted by , is a graph where . For every vertex , the neighborhood of in is the set of adjacent vertices of in . The closed neighborhood also contains vertex itself, i.e. . For simplicity of notation we denote for every . Furthermore, sometimes we refer to the discrete time steps as days. Throughout the paper we consider stochastic temporal graphs that exhibit an edge-centric evolution, i.e. every edge of is assigned one probability distribution for its appearance over time, independently of all other edges. We investigate the case where there is a “memory effect” that governs the probability of appearance of every edge over time. We distinguish now the cases where the the memory is zero or non-zero.
- Memoryless (or memory-0) model.
Every edge evolves stochastically and independently of other edges as follows: at every time step , appears in with probability and is absent with probability , independently of any other time step. The numbers are given parameters of the model. We denote this (memoryless) stochastic temporal graph by or simply .
- Memory- model.
This model of temporal graphs exhibits stochastic time-dependency of the edges: we assume an initial (arbitrary) sequence of snapshots, . At every time step , every edge appears independently of all other edges with probability that depends only on (the edge and) the history of appearance of in the previous snapshots. At every time step , this history is a
-bit binary vector, where a-entry (resp. -entry) on the -th position denotes absence (resp. appearance) of in , for . Therefore the snapshot is the graph that appears at time as the result of the following experiment: given the history of the appearance of edge in the last snapshots, belongs to independently with probability . We denote the memory- stochastic temporal graph by .
In the particular case where , the memory- stochastic temporal graph is the sequence of snapshots such that , where
is a Markov chain for the edgewith states (corresponding to non-appearance and appearance of , respectively) and probability transition matrix:
Using this formalism, (resp. ) is the probability that the edge changes its current state from absence to appearance (resp. from appearance to absence) in the next snapshot. Note here that, setting and for every edge , we obtain exactly the well-established edge-Markovian evolving graph model introduced by Clementi et al. .
2.1 The problems
This work studies two main problems, each under the models of stochastic temporal graphs defined above. To describe both of these problems, let us first recall that information in temporal graphs flows via journeys, i.e. temporal paths.
Definition 3 (Time-edge).
A time-edge in a temporal graph is a pair such that .
Definition 4 (Journey / temporal path).
Let be a temporal graph and be two vertices of . An - journey (or an - temporal path) in is a sequence of time-edges over a path in , where . The arrival time of the journey is the time of appearance of its last edge.
Definition 5 (Foremost Journey).
A foremost - journey in a temporal graph is an - journey with minimum arrival time amongst all - journeys in .
Notice that the arrival time of a foremost - journey in a stochastic temporal graph is a random variable, which we henceforth denote by . The first problem that we study here is how to compute the expected value of the latter, namely .
Problem 1 (Minimum Arrival).
Given a stochastic temporal graph on an underlying graph and two distinct vertices , compute the expected value of the arrival time of a foremost - journey, i.e. .
Now suppose that an individual (say Alice) is at day 0 at vertex and would like to arrive at vertex through a temporal path as quickly as possible. Denote by the vertex where she is located at time ; then . Every day Alice “wakes up” in the morning and looks at which edges are available in today’s snapshot; by only knowing her current position, the history of the last snapshots, and the input parameters of the stochastic temporal graph (i.e. the probabilistic rules of edge appearance), Alice needs to decide whether:
to stay at the vertex she currently is, or
to use an edge of to move to a neighboring vertex.
That is, is either equal to or equal to some vertex of .
A natural problem we can study here is to compute the expected arrival time of an - journey that Alice can follow, using a best policy111We use the term “policy” here (instead of “strategy”) since, as we will see later, this problem can be formulated using a Markov Decision Process (MDP). possible, i.e. a policy (sequence of actions) that minimizes her expected arrival time at . Notice that the arrival time of the journey suggested to Alice by the best policy is a random variable , whose distribution depends on the specific stochastic temporal graph. In particular, in the memoryless model, the expectation of depends only on the edges’ probabilities of appearance. In the memory- model, the expectation of also depends on the initial snapshots .
Problem 2 (Best Policy).
Given a stochastic temporal graph on an underlying graph and two distinct vertices , compute .
In particular, we will write and .
Difference between the two problems.
Before we proceed further, we first give an example illustrating that the problems Minimum Arrival and Best Policy are different. To demonstrate this, assume the memoryless model and consider the 4-cycle as the underlying graph. Let and and assume that, at any time step, each edge appears independently with probability .
Any best policy for Alice will wait until an edge incident to appears and then cross it; if both adjacent edges and appear at the same time, then it does not matter which one she chooses. The event “some edge adjacent to appears” occurs with probability , hence, the expected time until such an edge appears is . Furthermore, when Alice reaches one of the vertices or , an optimal policy will never suggest going back to , so Alice will have to wait until the last edge to appears, which takes steps on expectation. Overall, the optimal policy for Alice will take steps on expectation. This is the solution to Best Policy (see Problem 2).
On the other hand, Minimum Arrival (see Problem 1) asks for the expectation of the arrival time of a foremost - journey. To compute , denote by (resp. ) the arrival time of a journey allowed to use only edges and (resp. and ), when they appear. Then,
But the probability of the event is equal to the probability that either does not appear until (and including) step plus the probability that it appears within the first steps, and does not appear after that until (and including) . Therefore,
By symmetry we have and, by independence, for any :
By using the fact that , it follows that , which is strictly smaller than .
In fact, the gap between the solution to Minimum Arrival and the solution to Best Policy can be arbitrarily large: Consider the graph consisting of vertices and and vertex disjoint paths of length 2 between and . Assume also that, under the memoryless model, every edge incident to appears each day with probability and every edge incident to appears each day independently with probability . Similarly to the above example, the expected arrival time of a best policy for Alice is . On the other hand, the arrival time of the foremost journey from to will be equal to the first day after day 1 on which some edge incident to
appears. But the time needed for the latter to happen follows the geometric distribution with success probability. Therefore, the expected arrival time of the foremost journey will be , i.e. much smaller than .
As a final note, the expected arrival time of the foremost - journey is always upper-bounded by the minimum among the expected values of the arrival times of all -
journeys in the temporal graph. This is actually implied by a more general and well-known lemma in Probability Theory (Fatou’s lemma[16, p. 29]) which establishes that the expected value of the minimum among random variables is upper-bounded by the minimum among all the variables’ expectations.
3 Computing the expected minimum arrival time
3.1 Hardness of exact computation in the memoryless model
In this section we show that, even in the memoryless model, Minimum Arrival is #P-hard in both undirected graphs and directed acyclic graphs (DAGs). In the proof of the following theorem, the edges can be treated either as oriented, in which case we obtain the result for DAGs, or as non-oriented, in which case we obtain the result for undirected graphs.
Minimum Arrival in the memoryless model is #P-hard.
To prove the theorem we will provide a reduction from the #P-complete problem #PP2DNF . The latter problem is defined as follows. Let and be two disjoint sets of Boolean variables. A positive, partitioned 2-DNF formula is a DNF formula of the form:
for some . Given a positive, partitioned 2-DNF formula , the problem #PP2DNF asks for the number of truth assignments satisfying . Let be an instance of #PP2DNF. We define to be a graph with the vertex set and the edge set , see Figure 1.
First we claim222This claim was provided by Antoine Amarilli (https://cstheory.stackexchange.com/q/42239). that the number of satisfying assignments of is equal to the number of spanning subgraphs of which contain all the edges from and have a simple path from to of length 3. To see the claim, for every subset of edges we define a truth assignment that assigns iff and iff . Notice that every - path of length 3 in is of the form for some . Therefore, if the subgraph spanned by contains a path , then assigns 1 to both and , and hence satisfies . Conversely, given an assignment satisfying , we define a subgraph of spanned by the edge set . Since is satisfying assignment, there exists such assigns 1 to both and , and therefore the subgraph contains the - path of length 3.
Now we define an instance of Minimum Arrival in the memoryless model as follows. Let be the graph obtained from by adding three new vertices and four new edges , which all together form a new - path of length 4. For every edge we set , and for any other edge of we set . In this stochastic temporal graph the duration of a foremost journey from to is either 3, if for some the edge appears in time slot 1, and the edge appears in time slot 3, or 4 otherwise. In other words, the duration of a foremost - journey depends only on the subgraph of spanned by the edge set that appears in slot 1, and by the edge set that appears in slot 3. The duration is equal to 3 if and only if the subgraph of spanned by has an - path of length 3. Since every edge in appears independently with probability , it follows that the probability that this subgraph has a path of length 3 is equal to . Consequently,
and hence . Therefore, knowing the expected duration of an - foremost journey, we can efficiently compute the number of satisfying assignments of , which proves that the computation of is #P-hard. ∎
For every , Minimum Arrival in the memory- model is #P-hard.
3.2 The FPTAS for the memoryless model on series-parallel graphs
3.2.1 The case of paths
In this section we will consider a stochastic temporal graph with the underlying graph being a path .
Consider a stochastic temporal graph with a single edge which appears every day independently with probability , and let be a random variable equal to the duration of the foremost journey from one of the endpoints of to the other. Then . Notice that is a geometric random variable with probability mass function for , and expectation . Therefore . ∎
Let us denote by the expectation . Note that
In the remainder of this section we will show that the first terms of sum (1) already give a very good approximation of . In our analysis we will use the following bound.
Theorem 2 ().
Let , where and , are independent geometric random variables with parameters , respectively. Let . Then for any ,
Let be a number such that . Then
for every , where .
3.2.2 A general FPTAS approach
While deriving analytically and computing efficiently the exact solution of Minimum Arrival in a path is an easy task (cf. Lemma 1), it does not seem to be trivial for a slight generalization of paths, called parallel compositions of paths. A parallel composition of paths is the graph obtained from a collection of disjoint paths with end vertices , , respectively, by identifying the vertices in a single vertex , and by identifying the vertices in a single vertex .
It is not clear whether there exists an efficient procedure for computing the expected arrival time from to in a parallel composition of paths, even if the parallel paths are of equal length and all the probabilities of edge appearance are the same. In this section we present a general approach for developing -additive approximation algorithms333A feasible solution is -additive approximate if it is within additive factor from the optimal value. An algorithm is called an -additive approximation algorithm if it returns an -additive approximate solution for any instance. for computing the expected arrival time of a foremost journey in special classes of stochastic temporal graphs. In Section 3.2.3 we apply this approach to develop an efficient -additive approximation algorithm for the problem on the class of stochastic temporal graphs with underlying graphs being series-parallel graphs, which generalize parallel compositions of paths and graphs, in which all simple - paths are of the same length.
Throughout the section we denote by a memoryless stochastic temporal graph with vertices and edges, and by two distinct vertices in . Furthermore, we denote by the weighted graph obtained from the underlying graph by assigning to every edge the weight .
Let be a memoryless stochastic temporal graph, where is the underlying graph. A stochastic temporal subgraph of is a stochastic temporal graph which has a subgraph as an underlying graph and inherits all edge appearance probabilities from .
Let be a stochastic temporal subgraph of the stochastic temporal graph . Then for every natural number we have , and hence .
Let be the minimum weight of an - path in . Then .
Let and . Let for every and suppose that there exists an algorithm that computes in time the probabilities for all . Then there exists an algorithm that approximates within the additive factor of in time
Consequently, if is a polynomial in variables , and , then is an FPTAS on the instance .
Let be a minimum weight - path in , and let be the stochastic temporal subgraph of restricted to the vertices of . For convenience, let us denote for every . Then, by definition and Lemma 1, the weight of is equal to . Let . Then, by Observation 1 and Lemma 2, we have that
that is, approximates within the additive factor of .
Now we define the desired algorithm as follows:
Construct the graph and compute the minimum weight of an - path in using Dijkstra’s algorithm.
Using algorithm , compute the probabilities for every , where .
The above discussion implies that algorithm correctly computes the declared approximation of . It remains to justify the time complexity. First, Dijkstra’s algorithm can be implemented to work in time . Second, the assumption on ’s implies that , and hence . Therefore the assumption of the theorem implies that the last two steps of the algorithm run in time , which in turn implies the complexity bound and completes the proof. ∎
3.2.3 The FPTAS for stochastic temporal series-parallel graphs
In the present section we use the approach from Section 3.2.2 to derive a polynomial-time approximation scheme for stochastic temporal series-parallel graphs. According to Theorem 3, the development of such an algorithm reduces to the design of an efficient procedure of computing probabilities of the form , which is the main goal of this section.
Let be a graph and and be two distinct vertices in . The triple is a two-terminal series-parallel graph, with terminals and , if can be constructed by a sequence of the following two operations starting from a set of copies of a single-edge two-terminal series-parallel graph .
Parallel composition: Given a pair of two-terminal series-parallel graphs and , form a new two-terminal series-parallel graph by identifying and .
Series composition: Given a pair of two-terminal series-parallel graphs and , form a new two-terminal series-parallel graph by identifying , , and .
Finally, a graph is called series-parallel if is a two-terminal series-parallel graph for some pair of distinct vertices and of .
The sequence of parallel and series compositions leading to a two-terminal series-parallel graph can be conveniently represented by a decomposition tree. A binary tree with a labeling function is called a decomposition tree of a two-terminal series-parallel graph if and only if the leaves of are labeled with elements of such that every appears in exactly one label, internal nodes are labeled with p or s, and can be generated recursively using as follows: If is a single node with , then consists of the single edge with the source being the vertex with the smallest ID, if , and with the source being the vertex with the largest ID, if . Otherwise, let (resp. ) be the right (resp. left) subtree of and and be two-terminal series-parallel graphs with decomposition trees and : if (resp. s) then is the parallel (resp. series) composition of and .
We will make use of tree decompositions of series-parallel graphs in our algorithm. It is known that a tree decomposition of a series-parallel graph can be constructed in linear time.
Theorem 4 ().
Given a two-terminal series-parallel graph with vertices and edges, its tree decomposition can be computed in time .
Let be a stochastic temporal graph with the underlying graph being series-parallel. Let also be two distinct vertices in such that is a two-terminal series-parallel graph. We will present a dynamic programming algorithm which, for a given natural number , computes the set of probabilities:
For convenience, the algorithm will also support the set of probabilities:
Notice that having computed one of the sets of probabilities, the other set can be computed in time.
The algorithm is based on the following recursive equations. Since is a two-terminal series-parallel graph, it is either a single-edge graph, or can be obtained from smaller two-terminal series-parallel graphs , via one of the two composition operations.
In the case of a single-edge graph we have for every that:
where is the probability of appearance of the unique edge of the graph.
In the case of parallel composition we have for every that:
where and are the stochastic temporal subgraphs of restricted to the vertices of and , respectively.
In the case of series composition, we have for every that: