#
Journey Planning Algorithms for Massive Delay-Prone Transit Networks^{ †}

^{1}

^{2}

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

#### 1.1. Related Work

#### 1.2. Motivation

#### 1.3. Contribution of the Paper

#### 1.4. Structure of the Paper

## 2. Background

**Definition**

**1**

**.**A trip is a sequence $\mathrm{TRIP}=({c}_{1},{c}_{2},\cdots ,{c}_{k})$ of k connections that: (i) are operated by the same vehicle; (ii) share pairwisely departure and arrival stop, that is, formally, we have ${c}_{{i}^{\prime}-1}=(Z,{s}_{i},{s}_{j},{t}_{d},{t}_{a})$ and ${c}_{{i}^{\prime}}=(Z,{s}_{j},{s}_{k},{t}_{d}^{\prime},{t}_{a}^{\prime})$ with ${t}_{d}^{\prime}>{t}_{d}$ for any ${i}^{\prime}\in [2,k]$.

**Definition**

**2**

**.**A journey $J=({c}_{1},{c}_{2},\cdots {c}_{n})$ connecting two stops ${s}_{i}$ and ${s}_{j}$ is a sequence of n connections that: (i) can be operated by different vehicles; (ii) allows reaching a given target stop starting from a distinguished source stop at a given departure time $\tau \ge 0$, that is, the departure stop of ${c}_{1}$ is ${s}_{i}$, the arrival stop of ${c}_{n}$ is ${s}_{j}$ and the departure time of ${c}_{1}$ is larger than or equal to τ; (iii) is formed by connections that satisfy the time constraints imposed by the timetable, namely that if the vehicle of connection ${c}_{i}$ is different with reference to that of ${c}_{i+1}$ at a certain stop ${s}_{h}$, then the departure time of ${c}_{i+1}$ must be larger than the arrival time of ${c}_{i}$ plus mtt${}_{h}$.

**Definition**

**3**

**.**Let ${J}^{\prime}$ and ${J}^{\u2033}$ be two journeys, both connecting two stops ${s}_{i}$ and ${s}_{j}$. Then journey ${J}^{\u2033}$ is time-dominated by journey ${J}^{\prime}$ if and only if both the following conditions hold:

- the departure time of the first connection of ${J}^{\prime}$ is larger than the departure time of the first connection of ${J}^{\u2033}$;
- the arrival time of the last connection in ${J}^{\prime}$ is smaller than the arrival time of the last connection in ${J}^{\u2033}$.

## 3. Basic Public Transit Labeling

- a reduced time-expanded graph, a well-known data structure for storing transit networks (see e.g., Reference [9]);
- a reachability labeling, a compact labeling-based representation of the transitive closure of the said graph, computed via a (time-consuming) preprocessing step;
- an efficient query algorithm exploiting both the graph and the labeling to answer quickly to queries of interest at runtime.

#### 3.1. Reduced Time-Expanded Graph

- two vertices are added to V, namely a departure vertex ${v}_{d}^{c}$ and an arrival vertex ${v}_{a}^{c}$, respectively, each having an associated time $time({v}_{d}^{c})$ and $time({v}_{a}^{c})$, respectively, such that $time({v}_{d}^{c})={t}_{d}$ and $time({v}_{a}^{c})={t}_{a}$. Departure and arrival vertices are logically stored within the corresponding stop, that is each vertex ${v}_{d}^{c}$ (${v}_{a}^{c}$, respectively) belongs to the set of departure (arrival, respectively) vertices $\mathrm{DV}\left[i\right]$ ($\mathrm{AV}\left[j\right]$, respectively) of stop ${s}_{i}$ (${s}_{j}$, respectively);
- a directed connection arc (${v}_{d}^{c}$,${v}_{a}^{c}$) is added to A, connecting the corresponding departure and arrival vertices.

- for each trip $\mathrm{TRIP}=({c}_{0},{c}_{1},\cdots ,{c}_{k})$, and for each connection ${c}_{i}\in \mathrm{TRIP}$, $0\le i<k$, a bypass arc (${v}_{a}^{{c}_{i}}$,${v}_{a}^{{c}_{i+1}}$) is added to A, connecting the two arrival vertices of ${c}_{i}$ and ${c}_{i+1}$.
- for each pair of vertices $u,v\in dv\left[i\right]$, a waiting arc (u,v) is added to A if $time(v)\ge time(u)$, and there is no w in dv[i] such that $time(v)\ge time(w)\ge time(u)$.
- for each $u\in \mathrm{AV}\left[i\right]$ and for each $v\in \mathrm{DV}\left[i\right]$, a transfer arc (u,v) is added to A if $time(v)\ge time(u)+$mtt${}_{i}$, and there is no $w\in \mathrm{DV}\left[i\right]$ such that $time(w)<time(v)$ and $time(w)\ge time(u)+$mtt${}_{i}$.

#### 3.2. Reachability Labeling

#### 3.3. Query Algorithm

- $time(c)\ge \tau $;
- there is no arc (c’,c) adjacent to c such that ${c}^{\prime}\in \mathrm{DV}\left[i\right]$ and $time({c}^{\prime})\le time(c)$.

- $time(c)\ge \tau $;
- there is no arc (c’,c) adjacent to c such that ${c}^{\prime}\in \mathrm{DV}\left[i\right]$ and $time({c}^{\prime})\le time(c)$.

- ${\mathrm{L}}_{out}(c)\cap {\mathrm{L}}_{in}(v)\ne \varnothing $ (i.e., v is reachable from c);
- there is no other vertex ${v}^{\prime}\in \mathrm{AV}\left[j\right]$ having $time({v}^{\prime})<time(v)$ and ${\mathrm{L}}_{out}(c)\cap {\mathrm{L}}_{in}({v}^{\prime})\ne \varnothing $.

#### Stop Labeling

## 4. Multi-Criteria Public Transit Labeling

#### 4.1. Weighted Reduced Time-expanded Graph

#### 4.2. Shortest Path Labeling

- $(h,{\delta}_{hv})$ represents a vertex h in G from which v can be reached via a shortest path of length ${\delta}_{hv}$;
- $(h,{\delta}_{vh})$ represents a vertex h in G reachable from v via a shortest path of length ${\delta}_{vh}$;
- label entries satisfy the so–called cover property that is, for any pair of vertices $u,v\in V$, the distance $d(u,v)$ (i.e., the weight of the shortest path) from u to v in G can be retrieved by a linear scan of the two labels of u and v only.

**Definition**

**4**

**.**Given a graph $G=(V,A)$, a pair $s,t\in V$ and a 2hc-sp labeling L of G, a shortest path P is induced by L for pair $s,t\in V$ if, for any two vertices u and v in P, there exists a hub h of pair $(u,v)$ such that $h\in P$, or $h=u$, or $h=v$. The set of shortest paths between vertices s and t induced by L is denoted by Path $(s,t,L)$.

#### 4.3. Multi-Criteria Query Algorithm

- $time(c)\ge \tau $;
- there is no arc $({c}^{\prime},c)$ in G such that ${c}^{\prime}\in \mathrm{DV}\left[i\right]$ and $time({c}^{\prime})\ge \tau $, meaning that vertex c is associated with the smallest departure time larger than $\tau $.

## 5. Dynamic Public Transit Labeling

Algorithm 1: Algorithm rem-d-ptl. |

Input: red-te graph G, a delay $\delta >0$ affecting a connection ${c}_{m}$, the trip ${\mathrm{TRIP}}_{i}=({c}_{0},{c}_{1},\cdots ,{c}_{m},\cdots ,{c}_{k})$ including the connection Output: red-te graph G not including vertices of connections violating red-te constraints and the 2hc-r labeling l of G |

Algorithm 2: Algorithm ins-d-ptl. |

Input: red-te graph G not including vertices of connections violating red-te constraints, the 2hc-r labeling l of G, delay $\delta >0$, delayed connection ${c}_{m}$, trip ${\mathrm{TRIP}}_{i}=({c}_{0},{c}_{1},\cdots ,{c}_{m},\cdots ,{c}_{k})$ Output: red-te graph G including vertices of connections affected by the delay, the 2hc-r labeling l of G, the delay $\delta >0$ affecting the connection ${c}_{m}$ and the trip ${\mathrm{TRIP}}_{i}=({c}_{0},{c}_{1},\cdots ,{c}_{m},\cdots ,{c}_{k})$ including the connection |

Algorithm 3: Algorithm UpdateStopLab. |

Input: Outdated stop labeling sl, 2hc-r labeling l of G, sets us${}_{out}$, us${}_{in}$ Output: Updated stop labeling sl of l |

Algorithm 4: Algorithm RewireWaitingDep. |

Input: Graph $G=(V,A)$, departure vertex ${v}_{d}^{{c}_{j}}$, stop ${s}_{s}$ |

Algorithm 5: Algorithm RewireTransferDep. |

Input: Graph $G=(V,A)$, departure vertex ${v}_{d}^{{c}_{j}}$, successor vertex succ, stop ${s}_{s}$ |

Algorithm 6: Algorithm RewireArr. |

Input: Graph $G=(V,A)$, arrival vertex ${v}_{a}^{{c}_{j}}$, trip trip${}_{i}$, stop ${s}_{t}$ |

#### 5.1. Removal Phase

- pred is the unique vertex (if any) such that pred $\in \mathrm{DV}\left[s\right]$ and (pred,${v}_{d}^{{c}_{j}}$) $\in A$;
- succ is the unique vertex (if any) such that succ $\in \mathrm{DV}\left[s\right]$ and (${v}_{d}^{{c}_{j}}$,succ) $\in A$.

#### 5.2. Insertion Phase

- (a)
- ${v}_{d}^{{c}_{j}}\in V$ and ${v}_{a}^{{c}_{j}}\in V$;
- (b)
- ${v}_{d}^{{c}_{j}}\notin V$ and ${v}_{a}^{{c}_{j}}\notin V$;
- (c)
- ${v}_{d}^{{c}_{j}}\notin V$ and ${v}_{a}^{{c}_{j}}\in V$;
- (d)
- ${v}_{d}^{{c}_{j}}\in V$ and ${v}_{a}^{{c}_{j}}\notin V$.

#### 5.2.1. Discussion on Case I

#### 5.2.2. Discussion on Case II

#### 5.2.3. Discussion on Case III

#### 5.2.4. Discussion on Case IV

#### 5.3. Updating the Stop Labeling

**Theorem**

**1**

**.**Given an input timetable and a corresponding red-te graph G, let l be a 2hc-r labeling of G and let $s\mathrm{L}$ be a stop labeling associated to l. Assume $\delta >0$ is a delay occurring on a connection, that is, an increase of δ on its departure time. Let ${G}^{\prime}$, ${\mathrm{L}}^{\prime}$, and ${\mathrm{SL}}^{\prime}$ be the output of d-ptl when applied to G, l and $s\mathrm{L}$, respectively, by considering the delay. Then: (i) ${G}^{\prime}$ is a red-te graph for the updated timetable; (ii) ${\mathrm{L}}^{\prime}$ is a 2hc-r labeling for ${G}^{\prime}$; (iii) $s{\mathrm{L}}^{\prime}$ is a stop labeling for ${\mathrm{L}}^{\prime}$.

**Theorem**

**2**

**.**Algorithm d-ptl takes $\mathcal{O}(|\mathcal{C}{|}^{3}log\left|\mathcal{C}\right|)$ computational time in the worst case.

**Proof.**

## 6. Dynamic Multi-Criteria Public Transit Labeling

- right${}_{x}$: the set of vertices of V that are reachable from x in G, i.e., $u\in $right${}_{x}$ if and only if there exists a path from x to u in G;
- left${}_{x}$: the set of vertices of V that can reach x in G, i.e., $u\in $left${}_{x}$ if and only if there exists a path from u to x in G.

**Property**

**1.**

**Corollary**

**1.**

**Property**

**2.**

**Corollary**

**2.**

**Lemma**

**3.**

**Proof.**

Algorithm 7: Algorithm dag-decpll. |

Input: Directed Acyclic Graph G, 2hc-sp labeling l of G, vertex x to be removed from G Output: Directed Acyclic Graph ${G}^{\prime}=G\backslash \left\{x\right\}$, 2hc-sp labeling l of $G\backslash \left\{x\right\}$ |

#### 6.1. Forward Update

Algorithm 8: Algorithm customBFS. |

Input: Directed acyclic graph G, a vertex s of G, sets right${}_{x}$ and left${}_{x}$ Output: Set of pairs of vertices and relative distances from s 1 $Q\leftarrow \varnothing $ 2 ${A}_{s}\leftarrow \varnothing $ |

Algorithm 9: Procedure forward. |

Input: Directed Acyclic Graph G, 2hc-sp labeling l of G, vertex x to be removed from G, sets right${}_{x}$ and left${}_{x}$ |

#### 6.2. Backward Update

**Theorem**

**4**

**.**Let G be a DAG, let l be a 2hc-splabeling of G, and let x be a vertex of G. Let ${G}^{\prime}=G\backslash \left\{x\right\}$ and ${\mathrm{L}}^{\prime}$ be the output of algorithm dag-decpll when applied to G, l and x. Then: a) ${G}^{\prime}=G\backslash \left\{x\right\}$ is a DAG and b) ${\mathrm{L}}^{\prime}$ is a 2hc-sp labeling of ${G}^{\prime}$.

**Proof.**

**Theorem**

**5**

**.**Algorithm dag-decpll takes $O\left(\right|V{|}^{3})$ in the worst case.

**Proof.**

**Theorem**

**6**

**.**Given an input timetable and a corresponding wred-te graph G. Let l be a 2hc-sp labeling of G and let e-sl be an extended stop labeling associated to l Assume $\delta >0$ is a delay occurring on a connection, i.e. an increase of δ on its departure time. Let ${G}^{\prime}$, ${\mathrm{L}}^{\prime}$, and e-sl′ be the output of d-ptl when applied to G, l and e-sl, respectively, by considering the delay, in the multi-criteria setting. Then: (i) ${G}^{\prime}$ is a wred-te graph for the updated timetable; (ii) ${\mathrm{L}}^{\prime}$ is a 2hc-sp labeling for ${G}^{\prime}$; (iii) e-sl′ is an extended stop labeling for ${\mathrm{L}}^{\prime}$.

**Proof.**

#### 6.3. On Handling Arc Removals or Arc Weight Increases by dag-decpll

#### 6.4. Compacting a Multi-Criteria Public Transit Labeling

- v is a hub vertex reachable from (that reaches, respectively) at least one vertex in dv[i] (av[i], respectively);
- ${stoptime}_{i}(v)$ encodes the latest departure (earliest arrival, respectively) time to reach hub vertex v from one vertex in dv[i] (to reach a vertex in av[i] from vertex v, respectively);
- $transfer{s}_{i}(v)$ encodes the minimum number of transfers to reach hub vertex v from one vertex in dv[i] (to reach a vertex in av[i] from vertex v, respectively).

- there is no entry $(h,{stoptime}_{i}(h),transfer{s}_{i}(h))$ in e-sl${}_{out}(i)$;
- there exists an entry $(h,{stoptime}_{i}(h),transfer{s}_{i}(h))$ in e-sl${}_{out}(i)$ but ${\delta}_{vh}<\mathrm{MT}$ where$$\mathrm{MT}=\underset{(h,{stoptime}_{i}(h),transfer{s}_{i}(h))\in {e-s\mathrm{L}}_{out}(i)}{min}transfer{s}_{i}(h).$$

- there is no entry $(h,{stoptime}_{i}(h),transfer{s}_{i}(h))$ in e-sl${}_{in}(i)$;
- there exists an entry $(h,{stoptime}_{i}(h),transfer{s}_{i}(h))$ in e-sl${}_{in}(i)$ but ${\delta}_{hv}<\mathrm{MT}$ where$$\mathrm{MT}=\underset{(h,{stoptime}_{i}(h),transfer{s}_{i}(h))\in {e-s\mathrm{L}}_{in}(i)}{min}transfer{s}_{i}(h).$$

Algorithm 10: Algorithm e-sl Computation. |

Input: wred-te graph G, 2hc-sp labeling l of G Output: Extended stop labeling e-sl |

#### 6.5. Answering to Multi-criteria Queries via Extended Stop Labeling

#### 6.6. Updating the Extended Stop Labeling

**Theorem**

**7**

**.**Algorithm d-ptl in the multi-criteria setting takes $\mathcal{O}(|\mathcal{C}{|}^{4})$ computational time in the worst case.

**Proof.**

Algorithm 11: Procedure backward. |

Input: Directed Acyclic Graph G, $2\mathrm{HC}-\mathrm{SP}$ labeling L of G, vertex x to be removed from G, sets ${\mathrm{LEFT}}_{x}$ and ${\mathrm{RIGHT}}_{x}$. |

## 7. Experimental Study

^{©}CPU and 128 GB of main memory.

#### 7.1. Experimental Setup

- in the basic case: a 2hc-r labeling l, and a stop labeling sl of G;
- in the multi-criteria case: a 2hc-sp labeling l, and an extended stop labeling e-sl of G.

#### 7.2. Analysis

- d-ptl is a very effective and practical option for journey planning when dynamic, delay-prone networks have to be handled, especially when they are of very large size and yet require fast query answering;
- dag-decpll is a prominent solution to update 2hc-sp labelings in DAGs, faster than algorithm decpll, which is designed for general graphs;
- the newly proposed extended stop labeling is an effective compact version of the data structures used by ptl in the multi-criteria case that allows a significant reduction in the average query time.

## 8. Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## References

- Bast, H.; Delling, D.; Goldberg, A.V.; Müller-Hannemann, M.; Pajor, T.; Sanders, P.; Wagner, D.; Werneck, R.F. Route Planning in Transportation Networks. In Algorithm Engineering—Selected Results and Surveys; Lecture Notes in Computer Science; Kliemann, L., Sanders, P., Eds.; Springer: Berlin/Heidelberg, Germany, 2016; Volume 9220, pp. 19–80. [Google Scholar]
- Cionini, A.; D’Angelo, G.; D’Emidio, M.; Frigioni, D.; Giannakopoulou, K.; Paraskevopoulos, A.; Zaroliagis, C.D. Engineering graph-based models for dynamic timetable information systems. J. Discret. Algorithms
**2017**, 46–47, 40–58. [Google Scholar] - Delling, D.; Goldberg, A.V.; Pajor, T.; Werneck, R.F. Customizable Route Planning in Road Networks. Transp. Sci.
**2017**, 51, 566–591. [Google Scholar] - Dibbelt, J.; Pajor, T.; Strasser, B.; Wagner, D. Connection Scan Algorithm. J. Exp. Algorithmics
**2018**, 23, 1–7. [Google Scholar] - Delling, D.; Pajor, T.; Werneck, R.F. Round-Based Public Transit Routing. Transp. Sci.
**2015**, 49, 591–604. [Google Scholar] - Wagner, D.; Zündorf, T. Public transit routing with unrestricted walking. In Proceedings of the 17thWorkshop on Algorithmic Approaches for Transportation Modelling, Optimization, and Systems (ATMOS 2017), Vienna, Austria, 7–8 September 2017; Schloss Dagstuhl—Leibniz-Zentrum fuer Informatik: Saarbrücken/Wadern, Germany, 2017. [Google Scholar]
- Delling, D.; Dibbelt, J.; Pajor, T.; Zündorf, T. Faster transit routing by hyper partitioning. In Proceedings of the 17thWorkshop on Algorithmic Approaches for Transportation Modelling, Optimization, and Systems (ATMOS 2017), Vienna, Austria, 7–8 September 2017; Schloss Dagstuhl—Leibniz-Zentrum fuer Informatik: Saarbrücken/Wadern, Germany, 2017. [Google Scholar]
- Delling, D.; Dibbelt, J.; Pajor, T. Fast and Exact Public Transit Routing with Restricted Pareto Sets. In Proceedings of the Twenty-First Workshop on Algorithm Engineering and Experiments (ALENEX), SIAM, San Diego, CA, USA, 7–8 January 2019; pp. 54–65. [Google Scholar]
- Pyrga, E.; Schulz, F.; Wagner, D.; Zaroliagis, C. Efficient models for timetable information in public transportation systems. ACM J. Exp. Algorithmics
**2008**, 12, 1–39. [Google Scholar] - Cionini, A.; D’Angelo, G.; D‘Emidio, M.; Frigioni, D.; Giannakopoulou, K.; Paraskevopoulos, A.; Zaroliagis, C.D. Engineering Graph-Based Models for Dynamic Timetable Information Systems. In Proceedings of the 14th Workshop on Algorithmic Approaches for Transportation Modelling, Optimization, and Systems (ATMOS14), Wroclaw, Poland, 11 September 2014; Schloss Dagstuhl: Saarbrücken/Wadern, Germany, 2014; Volume 42, pp. 46–61. [Google Scholar]
- Giannakopoulou, K.; Paraskevopoulos, A.; Zaroliagis, C. Multimodal Dynamic Journey-Planning. Algorithms
**2019**, 12, 213. [Google Scholar] - Witt, S. Trip-Based Public Transit Routing. In Algorithms–ESA 2015; Bansal, N., Finocchi, I., Eds.; Springer: Berlin/Heidelberg, Germany, 2015; pp. 1025–1036. [Google Scholar]
- Delling, D.; Dibbelt, J.; Pajor, T.; Werneck, R.F. Public Transit Labeling. In International Symposium on Experimental Algorithms (SEA15); Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2015; Volume 9125, pp. 273–285. [Google Scholar]
- Wang, S.; Lin, W.; Yang, Y.; Xiao, X.; Zhou, S. Efficient Route Planning on Public Transportation Networks: A Labelling Approach. In Proceedings of the 2015 ACM International Conference on Management of Data (SIGMOD15), ACM, Melbourne, Australia, 31 May–4 June 2015; pp. 967–982. [Google Scholar]
- Akiba, T.; Iwata, Y.; Yoshida, Y. Dynamic and historical shortest-path distance queries on large evolving networks by pruned landmark labeling. In Proceedings of the 23rd International World Wide Web Conference (WWW14), ACM, Seoul, Korea, 7–11 April 2014; pp. 237–248. [Google Scholar]
- Cicerone, S.; D’Emidio, M.; Frigioni, D. On Mining Distances in Large-Scale Dynamic Graphs. In Proceedings of the 19th Italian Conference on Theoretical Computer Science (ICTCS18), Urbino, Italy, 18–20 September 2018; Volume 2243, pp. 77–81. [Google Scholar]
- D’Angelo, G.; D’Emidio, M.; Frigioni, D. Fully dynamic update of arc-flags. Networks
**2014**, 63, 243–259. [Google Scholar] - D’Angelo, G.; D’Emidio, M.; Frigioni, D.; Vitale, C. Fully Dynamic Maintenance of Arc-flags in Road Networks. In International Symposium on Experimental Algorithms; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2012; Volume 7276, pp. 135–147. [Google Scholar]
- D’Andrea, A.; D’Emidio, M.; Frigioni, D.; Leucci, S.; Proietti, G. Experimental Evaluation of Dynamic Shortest Path Tree Algorithms on Homogeneous Batches. In International Symposium on Experimental Algorithms; Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2014; Volume 8504, pp. 283–294. [Google Scholar]
- D’Angelo, G.; D’Emidio, M.; Frigioni, D. Distance Queries in Large-Scale Fully Dynamic Complex Networks. In International Workshop on Combinatorial Algorithms; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2016; Volume 9843, pp. 109–121. [Google Scholar]
- D’Angelo, G.; D’Emidio, M.; Frigioni, D. Fully Dynamic 2-Hop Cover Labeling. J. Exp. Algorithmics
**2019**, 24, 1–6. [Google Scholar] - Qin, Y.; Sheng, Q.Z.; Falkner, N.J.G.; Yao, L.; Parkinson, S. Efficient computation of distance labeling for decremental updates in large dynamic graphs. World Wide Web
**2017**, 20, 915–937. [Google Scholar] - D’Emidio, M.; Khan, I. Dynamic Public Transit Labeling. In Proceedings of the International Conference on computational Science And Its Applications, Saint Petersburg, Russia, 1–4 July 2019; Volume 11619, pp. 103–117. [Google Scholar]
- Zhu, A.D.; Lin, W.; Wang, S.; Xiao, X. Reachability queries on large dynamic graphs: a total order approach. In Proceedings of the 2014 ACM SIGMOD International Conference on Management of Data (SIGMOD14), ACM, Snowbird, UT, USA, 22–27 June 2014; pp. 1323–1334. [Google Scholar]
- Warburton, A. Approximation of Pareto Optima in Multiple-Objective, Shortest-Path Problems. Oper. Res.
**1987**, 35, 70–79. [Google Scholar] [CrossRef] - Cohen, E.; Halperin, E.; Kaplan, H.; Zwick, U. Reachability and Distance Queries via 2-Hop Labels. SIAM J. Comput.
**2003**, 32, 1338–1355. [Google Scholar] - Cheng, J.; Huang, S.; Wu, H.; Fu, A.W.C. TF-Label: A topological-folding labeling scheme for reachability querying in a large graph. In Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data (SIGMOD13), New York, NY, USA, 22–27 June 2013; pp. 193–204. [Google Scholar]
- Yano, Y.; Akiba, T.; Iwata, Y.; Yoshida, Y. Fast and Scalable Reachability Queries on Graphs by Pruned Labeling with Landmarks and Paths. In Proceedings of the 22nd ACM International Conference on Information & Knowledge Management (CIKM13), ACM, San Francisco, CA, USA, 27 October–1 November 2013; pp. 1601–1606. [Google Scholar]
- Colella, F.; D’Emidio, M.; Proietti, G. Simple and Practically Efficient Fault-tolerant 2-hop Cover Labelings. In Proceedings of the 18th Italian Conference on Theoretical Computer Science and the 32nd Italian Conference on Computational Logic, Naples, Italy, 26–28 September 2017; Volume 1949, pp. 51–62. [Google Scholar]
- Staudt, C.L.; Sazonovs, A.; Meyerhenke, H. NetworKit: A tool suite for large-scale complex network analysis. Netw. Sci.
**2016**, 4, 508–530. [Google Scholar] [CrossRef] [Green Version]

**Figure 1.**An example of red-te graph for a timetable with three stops X, Y and Z, five trips $\{a,b,c,d,e\}$. Details of the timetable are reported in Table 1. Each ellipse groups together vertices in $\mathrm{DV}\left[i\right]\cup \mathrm{AV}\left[i\right]$ for each stop $i\in \{X,Y,Z\}$, where vertices on the left side of each group, filled in light blue, are arrival vertices, while vertices on the right side, filled in light yellow, are departure vertices. The latter are connected to the former via transfer arcs. The numbers within vertices show the associated time, where the minimum transfer time is assumed to be, for the sake of simplicity, mtt${}_{X}$=mtt${}_{Y}$=mtt${}_{Z}$$=5$ min for all stops. Departure and arrival vertices of connections of the same trip are highlighted via a same border color. Bypass arcs are drawn in green while consecutive departure vertices of a same set $\mathrm{DV}\left[i\right]$ are connected via waiting arcs.

**Figure 2.**The red-te graph obtained after performing Algorithm rem-d-ptl (Algorithm 1) on the graph of Figure 1, as a consequence of a delay $\delta $ of 10 min occurring on the first connection of Trip b. The time associated to the departure vertex (filled in orange) of said connection is updated, but the vertex and its corresponding transfer arc (drawn in orange) are not removed, since the ordering and the red-te properties are not broken. Arrival and departure vertices of the connections following the one affected by the delay in the same trip are filled in red. Since they break the red-te properties (e.g., 35 becomes larger than 30 in Stop Y) they are removed from the graph, along with the corresponding adjacent arcs, shown via dashed red arrows. A waiting arc, in blue, is added during the removal phase to connect departure vertices that remain in $\mathrm{DV}\left[Y\right]$ to restore the red-te properties.

**Figure 4.**An example of execution of the procedure for rewiring transfer and waiting arcs given in Algorithms 4 and 5, respectively. On the left we show part of a sample graph, relative to a stop P with the assumption that mtt${}_{\mathit{P}}$$=5$ min, that is violating the red-te properties. In particular, no waiting and transfer arcs are associated with the vertex colored in green. To restore the red-te properties both transfer and waiting arcs must be added. Concerning the former, Algorithm 5 is executed and the resulting graph is shown in the middle, where dashed arcs in red (arcs in blue, respectively) are the removed arcs (newly inserted arcs, respectively). Regarding the latter, instead, Algorithm 4 is executed. The resulting red-te graph (on the right side) is the final outcome. Dashed arcs in red are the removed arcs, while arcs in blue are the newly added ones.

**Figure 5.**Part of a sample graph, relative to three stops, namely P, Q and R, is shown on the left side, where the minimum transfer time is assumed to be, for the sake of simplicity, mtt${}_{\mathit{P}}$=mtt${}_{\mathit{Q}}$=mtt${}_{\mathit{R}}$$\phantom{\rule{3.33333pt}{0ex}}=\phantom{\rule{3.33333pt}{0ex}}5$ min for all stops. Both transfer and bypass arcs for the vertex of av[Q] highlighted in green must be rewired, in order to restore red-te properties. To this end, Algorithm 6 is executed, and the result is shown on the right, with newly added arcs are highlighted in blue.

**Table 1.**An example of timetable with three stops $X,Y,Z$ and five vehicles $\alpha ,\beta ,\gamma ,\varphi ,\theta $.

Departure Stop | Arrival Stop | Departure Time | Arrival Time | VehicleID | Minimum Transfer Time |
---|---|---|---|---|---|

− | X | − | 00:05 | $\alpha $ | 5 |

− | X | − | 00:07 | $\beta $ | 5 |

X | Y | 00:10 | 00:15 | $\alpha $ | 5 |

X | Y | 00:15 | 00:20 | $\beta $ | 5 |

Y | − | 00:20 | − | $\alpha $ | − |

Y | Z | 00:25 | 00:30 | $\beta $ | 5 |

Y | Z | 00:30 | 00:39 | $\gamma $ | 5 |

X | Y | 00:35 | 00:42 | $\varphi $ | 5 |

Z | − | 00:40 | − | $\theta $ | 5 |

Y | − | 00:50 | − | $\varphi $ | − |

Z | − | 00:50 | − | $\gamma $ | − |

**Table 2.**Details of input datasets for the basic setting: preprocessing time is expressed in seconds, labeling size in megabytes.

Network | # Stops | Graph | Preprocessing Time | Labeling Size | |||
---|---|---|---|---|---|---|---|

$\left|\mathit{V}\right|$ | $\left|\mathit{A}\right|$ | l | sl | l | sl | ||

London | 5221 | 3,066,852 | 5,957,246 | 4494.00 | 5.19 | 5856 | 529 |

Madrid | 4698 | 3,971,870 | 7,859,375 | 10,559.10 | 13.66 | 12,295 | 2653 |

Rome | 9273 | 5,502,796 | 10,893,752 | 17,081.05 | 30.18 | 18,531 | 5262 |

Melbourne | 27,237 | 9,757,352 | 18,389,454 | 3774.00 | 12.79 | 8293 | 1136 |

**Table 3.**Details of input datasets for the multi-criteria setting: preprocessing time is expressed in seconds, labeling size in megabytes.

Network | # Stops | Graph | Preprocessing Time | Labeling Size | |||
---|---|---|---|---|---|---|---|

$\left|\mathit{V}\right|$ | $\left|\mathit{A}\right|$ | l | e-sl | l | e-sl | ||

Palermo | 1714 | 563,064 | 1,112,110 | 7828.00 | 3.43 | 4687 | 372 |

Barcelona | 3232 | 1,201,256 | 2,075,005 | 14,207.00 | 7.99 | 4219 | 359 |

Luxembourg | 2802 | 1,239,870 | 2,438,413 | 42,701.70 | 11.75 | 30,491 | 1129 |

Prague | 4940 | 1,755,078 | 2,475,801 | 29,288.60 | 18.57 | 4243 | 694 |

Venice | 2173 | 1,373,674 | 2,526,500 | 19,114.03 | 5.87 | 7426 | 189 |

**Table 4.**Comparison between d-ptl and ptl in the basic setting, in terms of computational time. The first column shows the considered network while the 2nd and the 3rd columns show the average time taken by d-ptl to update the labeling and the stop labeling, respectively, after a delay occurs in the network. The 4th and the 5th columns show the average time taken by ptl to recompute from scratch the labeling and the stop labeling, respectively, after a delay occurs in the network. Finally, the 6th column shows the speed-up, that is the ratio of the sum of the values in the 2nd and the 3rd columns to the sum of the values in the 4th and the 5th columns.

Network | (Basic) d-ptl Avg. Update Time (Seconds) | (Basic) ptl Avg. Reprocessing Time (Seconds) | Speed-up | ||
---|---|---|---|---|---|

l | sl | l | sl | ||

London | 8.64 | 2.48 | 4417.65 | 5.50 | 397.77 |

Madrid | 17.47 | 7.76 | 10,495.40 | 14.20 | 416.55 |

Rome | 12.36 | 14.49 | 16,847.00 | 29.50 | 628.55 |

Melbourne | 4.08 | 7.25 | 3807.00 | 11.50 | 337.03 |

**Table 5.**Comparison between d-ptl and ptl in the multi-criteria setting, in terms of computational time. The first column shows the considered network while the 2nd, the 3rd, and the 4th columns show the average time taken by d-ptl to update the labeling and the extended stop labeling, respectively, after a delay occurs in the network. The time taken to update the labeling, in this case, is divided in two fields to highlight which of the two components of d-ptl is more time consuming. The 5th and the 6th columns show the average time taken by ptl to update the wred-te graph and recompute from scratch the labeling and the extended stop labeling, respectively, after a delay occurs in the network. Finally, the 7th column shows the speed-up, that is the ratio of the sum of the values in the 2nd, 3rd and 4th columns to the sum of the values in the 5th and the 6th columns.

Network | (Multi-Criteria) d-ptl Avg. Update Time (Seconds) | (Multi-Criteria) ptl Avg. Reprocessing Time (Seconds) | Speed-up | |||
---|---|---|---|---|---|---|

l | e-sl | l | e-sl | |||

incpll | dag-decpll | |||||

Palermo | 210.37 | 135.86 | 3.01 | 7807.14 | 3.39 | 22.36 |

Barcelona | 25.19 | 2.50 | 5.65 | 14,156.90 | 7.62 | 424.85 |

Luxembourg | 617.44 | 348.92 | 6.57 | 43,275.70 | 11.50 | 44.49 |

Venice | 167.67 | 3.10 | 3.50 | 19,146.60 | 5.69 | 109.90 |

Prague | 597.93 | 22.92 | 10.16 | 29,435.90 | 20.84 | 40.86 |

**Table 6.**Comparison between d-ptl and ptl in the basic setting, in terms of query time. The first column shows the considered network. The 2nd and 4th columns (3rd and 5th, respectively) show the average computational time for performing an earliest arrival (profile, respectively) query. In particular, columns 2nd and 3rd refer to average query times obtained from the labelings updated via d-ptl, while columns 4th and 5th refer to those obtained from the labelings recomputed from scratch via ptl.

Network | (Basic) d-ptl Avg. Query Time (Milli-Seconds) | (Basic) ptl Avg. Query Time (Milli-Seconds) | ||
---|---|---|---|---|

eaq | pq | eaq | pq | |

London | 0.01 | 0.10 | 0.01 | 0.14 |

Madrid | 0.03 | 0.35 | 0.03 | 0.34 |

Rome | 0.04 | 0.18 | 0.04 | 0.19 |

Melbourne | 0.05 | 0.26 | 0.06 | 0.27 |

**Table 7.**Comparison between d-ptl and ptl in the basic setting, in terms of space overhead. The first column shows the considered network. The 2nd and the 3rd columns show the average size of the 2hc-r labeling and the stop labeling, respectively, updated via d-ptl. The 4th and the 5th columns, instead, show the average size of the 2hc-r labeling and the stop labeling, respectively, when recomputed from scratch via ptl.

Network | (Basic) d-ptl Avg. Space (MB) | (Basic) ptl Avg. Space (MB) | ||
---|---|---|---|---|

l | sl | l | sl | |

London | 5894 | 533 | 5902 | 532 |

Madrid | 12,391 | 2669 | 12,395 | 2663 |

Rome | 18,531 | 5260 | 18,512 | 5252 |

Melbourne | 8298 | 1140 | 8300 | 1138 |

**Table 8.**Comparison between d-ptl and ptl in the multi-criteria setting, in terms of query time. The first column shows the considered network. The 2nd and the 4th (3rd and 5th, respectively) columns show the average computational time for performing a multi-criteria query by the two approaches without (with, respectively) extended stop labelings. Columns 2nd and 3rd refer to average query times obtained from the labelings updated via d-ptl, while columns 4th and 5th refer to those obtained from the labeling recomputed from scratch, respectively.

Network | (Multi-criteria) d-ptl Avg. Query Time (Milli-Seconds) | (Multi-criteria) ptl Avg. Query Time (Milli-Seconds) | ||
---|---|---|---|---|

mc-ea | mc-ea with e-sl | mc-ea | mc-ea with e-sl | |

Palermo | 1.25 | 0.52 | 1.25 | 0.53 |

Barcelona | 0.09 | 0.01 | 0.08 | 0.01 |

Luxembourg | 2.64 | 1.10 | 2.66 | 1.10 |

Venice | 0.81 | 0.06 | 0.76 | 0.06 |

Prague | 2.93 | 0.03 | 3.54 | 0.35 |

**Table 9.**Comparison between d-ptl and ptl in the multi-criteria setting, in terms of space overhead. The first column shows the considered network. The 2nd and the 3rd columns show the average size of the 2hc-sp labeling and the extended stop labeling, respectively, when updated via d-ptl, while the 4th and the 5th columns show the average size of the 2hc-sp labeling and the extended stop labeling, respectively, when recomputed from scratch. Note that, regarding the extended stop labeling (cf 3rd and 5th column), the update is done by the procedure given in this paper (cf Section 6.6) while the recomputation from scratch is done by Algorithm 10, that is also not originally included in the ptl framework.

Network | (Multi-Criteria) d-ptl Avg. Space (MB) | (Multi-Criteria) ptl Avg. Space (MB) | ||
---|---|---|---|---|

l | e-sl | l | e-sl | |

Palermo | 4764 | 372 | 4737 | 373 |

Barcelona | 4253 | 360 | 4219 | 360 |

Luxembourg | 30,557 | 1129 | 30,519 | 1126 |

Venice | 7443 | 190 | 7413 | 190 |

Prague | 4250 | 694 | 4251 | 695 |

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

D’Emidio, M.; Khan, I.; Frigioni, D.
Journey Planning Algorithms for Massive Delay-Prone Transit Networks. *Algorithms* **2020**, *13*, 2.
https://doi.org/10.3390/a13010002

**AMA Style**

D’Emidio M, Khan I, Frigioni D.
Journey Planning Algorithms for Massive Delay-Prone Transit Networks. *Algorithms*. 2020; 13(1):2.
https://doi.org/10.3390/a13010002

**Chicago/Turabian Style**

D’Emidio, Mattia, Imran Khan, and Daniele Frigioni.
2020. "Journey Planning Algorithms for Massive Delay-Prone Transit Networks" *Algorithms* 13, no. 1: 2.
https://doi.org/10.3390/a13010002