1. Introduction
This paper extends our previous paper on contact sequence temporal graphs [
1]. We have extended our previous work mainly by adding two path-finding algorithms to our proposed TRG data structure. Also, we have considered the case when the TRG graph is acyclic and proposed path-finding algorithms that can further benefit from that property.
Temporal graphs are graphs that change over time. Therefore, temporal information is incorporated in the edges or vertices. In this paper, we are only concerned with graphs in which the temporal information is incorporated in the edges. Temporal graphs have applications in modeling a wide range of phenomena, such as communication networks, computational biology, transportation networks, the spread of viruses, social networks, etc. [
2,
3,
4,
5,
6].
In a contact sequence temporal graph , each edge has the format where u and v are the source and target vertices, respectively, of the edge; t is its time stamp and w () is the time it takes to get from u to v along this edge. We may begin traveling from u only at the time indicated by the timestamp t. We arrive at v at the time . Contact sequence temporal graphs may have multiple edges with the same source and target vertices, each with a different time stamp and possibly different weight.
An example of a real-life application of contact sequence temporal graphs is transportation networks such as the flight network of a particular airline. The nodes of the contact sequence temporal graph represent airports, and the edges model scheduled flights. Each flight can be described with (source, destination, start time and duration). There can be multiple flights between any two airports, each departing at a different time and possibly having a different duration.
Another model for describing temporal graphs is the interval temporal graph, . This model has at most one edge between any pair of vertices (u and v). Each edge is labeled with a set of triplets of the form where s and f denote the start and the end of a time interval when we are allowed to commence travel from u (i.e., one can begin to travel on this edge at any time T, ). Like the contact sequence model, w is the weight and denotes the travel time.
One can easily verify that every contact sequence temporal graph has an equivalent interval temporal graph and that the reverse is also true when time is discrete. To make it clear, assume in a contact sequence temporal graph
G, we have the edges
and
. In the equivalent interval temporal graph, we will have only one edge between the nodes
u and
v and that edge is labeled with the following sequence of intervals:
. Similarly, consider an interval temporal graph
(assume time is restricted to integer values) containing an edge
between nodes
and
which is labeled with the following interval
where
. In the equivalent contact sequence temporal graph, we will have the
edges between
and
:
where
. Whether we use contact sequence temporal graphs or interval temporal graphs depends on the nature of the application at hand [
4].
A
time-respecting path is defined as a path in which the departure time from each vertex is ≥ the arrival time at the same vertex. We note that the terms “path” and “time-respecting path” may be used interchangeably in this paper. Our focus is on four types of time-respecting paths: “earliest arrival” (also known as “foremost”) paths, “fastest” paths, “shortest” paths and “min-hop” paths. Examples of the different types of time-respecting paths used in the literature can be found in [
7,
8]. The input of a typical path-finding problem is an interval
. Here,
is the earliest time we can start from the source and
is the latest time we are allowed to arrive at the destination. Let
u be the source and
v the destination vertices, respectively. The
feasible paths from
u to
v are defined as time-respecting paths that leave
u at or after
and arrive at
v at or before
. The paths we study in this paper should all be feasible. The earliest arrival or foremost path minimizes the arrival time at
v. The fastest path minimizes the difference between the arrival time at
v and the departure time from
u. A shortest path minimizes the sum of the weights of the edges on the path, and a min-hop path minimizes the number of edges on the path. A
Time Respecting Graph (TRG) is a graph in which all the paths are time respecting.
Wu et al. [
8] propose two models to represent contact sequence temporal graphs. The first is a time-ordered sequence of edges (i.e., non-decreasing order of timestamps), which we call OSE in this paper, and the second is a model based on the time-respecting nature of the graph, which we call TRG_Wu. They develop algorithms for finding single-source, all-destinations optimal paths for both models. Their proposed algorithms based on the contact sequence temporal graph modeling are more efficient than those proposed in [
7], which are based on the interval temporal graph models. Moreover, they show that their OSE algorithms are faster than their TRG_Wu algorithms for all considered path-finding problems, except for the fastest paths problem, where each model was faster on some datasets and slower on others.
Although it has been shown that the OSE-based algorithms are faster than those based on the TRG_Wu model for a specific group of path-finding problems, they are certainly slower on other problems. One group of those problems depends on the local properties of the graph. An example is the problem of finding the existence of a one-hop or two-hop path between two vertices. Therefore, developing a model superior to TRG_Wu on shallow-neighborhood-search problems and competitive with or more efficient than OSE on single-source all-destinations path-finding problems is very beneficial. We note that the OSE algorithms of Wu et al. [
8] require that all edges of the temporal contact sequence graph have a strictly positive weight. Zschoche et al. [
9] propose an alternative TRG data structure, TRG_Zchoche, for contact sequence temporal graphs. This data structure requires all edge weights to be integer and >0. They develop a linear-time algorithm based on the topological ordering of vertices for the single-source all-destinations shortest paths problem.
In this paper, we propose a new model for TRGs that we call TRG_Ours. Our proposed model is more memory-efficient than both TRG_Wu and TRG_Zschoche. We develop algorithms for the single-source all-destinations fastest, minhop, shortest and foremost path problems and use them to show the effectiveness of our model relative to TRG_Wu. We also propose algorithms for the case when the TRG graphs are acyclic and demonstrate the effectiveness of our algorithms using the same path problems.
The outline of this paper is as follows. Related work is reviewed in
Section 1. The TRG models TRG_Wu, TRG_Zschoche, and TRG_Ours are described in
Section 2.1, and the memory requirements of each are analyzed. Our algorithms for general TRG_Ours are described in
Section 2.2, and our algorithms for acyclic TRG_Ours are described in
Section 2.3. Experimental results are presented in
Section 3.1. We conclude in
Section 4.
Related Work
We have already mentioned the models proposed by Wu et al. [
8] in
Section 1. Due to the closeness of their work to ours, we will discuss their method in detail in the following sections. Their work improves on the work of Xuan et al. [
7] for interval temporal graphs.
Finding optimal paths in the presence of constraints is the focus of another group of methods. Examples are the works of [
10,
11] for finding approximate optimal paths. In the problems studied by Hassan et al. [
12], edge labels are used for classification purposes. Examples of edge labels are family/friend relationships in social networks.
Himmel et al. [
13] propose a model that allows adding min and max wait times to each vertex. Their proposed model can be used to optimize a linear combination of criteria (e.g., fastest, shortest, foremost). They show the median runtime of their algorithm to be comparable with those proposed in [
8]. However, the average runtime of their algorithm is around 10 times greater than those used in [
8] (the average is taken over all the optimization criteria). The work by Bentert et al. [
14] is an extension of this work which considers more optimization criteria, provides the missing proofs, and presents extended experimental results. Casteigts et al. [
15] use a TRG similar to that of [
9] with the main difference that they connect an edge to a node only if the timestamp of the edge is within
of the timestamp of the node (where
is an upper bound on the time one could remain in a node).
When the edge updates are not known in advance, another group of methods can be used, such as the ones in [
16,
17,
18]. They form Shortest Path Trees (SPTs) rooted at each vertex. The trees are updated after each temporal evolution of the graph.
Some methods choose a group of vertices as the landmark nodes. They then run a pre-processing step to calculate the distances from each vertex to those landmark nodes. These partial distances are combined to calculate the distances between each pair of vertices and are updated each time the graph evolves. Different types of landmark nodes have been considered in the literature. Examples are the hub nodes [
19], nodes in a radius of
K from a given node [
20] and nodes for which the triangle equality holds for a sample subset of paths [
21]. These methods are appropriate for problems in which edge updates are not known in advance.
Wu et al. [
22] show that TRG_Wu is acyclic for contact sequence temporal graphs with no edge weight equal to 0. They develop an indexing scheme to efficiently answer reachability and time-based fastest and shortest paths queries for acyclic TRG_Wu. They allow for the contact sequence graph and hence its TRG_Wu to change over time by adding edges. The algorithms developed by Dean [
23] also benefit from the topological ordering of nodes in the acyclic transformation of dynamic graphs. Their transformed graph is divided into different temporal snapshots. The minimum cost paths algorithm uses dynamic programming on the topologically sorted vertices in reverse chronological order.
A graph model has been used in [
24] in which the geographic locations of the nodes determine their distances, and the nodes can be added or removed dynamically with time. The temporal evolution of the vertices has also been studied in other work such as [
25]. We may need to calculate the upper bounds on the length of the optimal paths. An example application is the mobile ad-hoc networks in which flooding time can be used to compute the upper bound on the length of the fastest path. The search space for finding a semi-optimal path can be reduced by putting an upper bound of the flooding time [
26]. Differential equations have been used in self-adapting methods that converge to the optimal paths for a fixed source node and edge updates that are not known in advance [
27].
Path algorithms largely depend on the specific problem requirements. Different models and algorithms have been developed, each with emphasis on a particular requirement such as query response time [
28], security [
29], path difference between two consecutive graph snapshots [
30] and number of destination nodes [
31]. Akrida et al. [
32] consider stochastic temporal graphs in which the probability of an edge existing in time
t depends on its existence in the previous
k time steps. Brunelli et al. [
33] find Pareto-optimal paths in temporal graphs for cases when the start time is fixed.
Distributed algorithms for finding shortest paths are developed in [
34,
35,
36], and surveys of the general area of temporal graphs appear in [
37,
38,
39].
4. Discussion
We have developed a new time-respecting graph data structure TRG_Ours for contact sequence temporal graphs. This data structure has fewer vertices and edges than previously proposed TRG structures: TRG_Wu and TRG_Zschoche. Benchmark experiments conducted for the fastest, min-hop, shortest and foremost paths problems indicate that TRG_Ours is superior to TRG_Wu on contact sequence temporal graphs whose TRG is cyclic. In fact, TRG_Ours outperformed TRG_Wu on all but one of our datasets on the fastest paths, min-hop paths, and foremost paths problems. It outperformed TRG_Wu on all 12 datasets for the shortest path problem.
Contact sequence temporal graphs with no edge whose weight is 0 result in acyclic TRGs. For acyclic TRGs, the path problems considered in this paper may be solved more simply using an algorithm based on a topological ordering of the vertices. When there are no edges whose weight is 0, these path problems may be solved using the OSE data structure of [
8]. The algorithms for acyclic TRG_Ours were faster than those for acyclic TRG_Wu on all 12 of our datasets and for all four path problems studied in this paper. The acyclic algorithms using TRG_Ours were also faster than the OSE algorithms on all 12 datasets for the fastest paths, min-hop paths, and shortest paths problems but slower on all 12 datasets for the foremost paths problem.
We did not experiment with TRG_Zschoche as this data structure is expected to have more vertices and edges than TRG_Wu (except in the particular case when all edge weights are 1), and so it is expected to give an inferior performance than TRG_Wu. We have also pointed out that TRG structures are superior to OSE on problems requiring only local information (shallow neighborhood search problems), such as one-hop and 2-hop neighbors. So, while Wu et al. [
8] conclude that OSE is the data structure of choice for single-source all-destinations problems, our work indicates that TRG structures can be highly competitive with OSE while providing distinct advantages for shallow neighborhood search problems.