Quickest Path Queries on Transportation Network

Quickest Path Queries on Transportation Network

Radwa El Shawi NICTAthanks: NICTA is funded by the Australian Government as represented by the Department of Broadband, Communications and the Digital Economy and the Australian Research Council through the ICT Centre of Excellence program., Sydney, Australia. {radwa.elshawi,joachim.gudmundsson}@nicta.com.au    Joachim Gudmundsson NICTAthanks: NICTA is funded by the Australian Government as represented by the Department of Broadband, Communications and the Digital Economy and the Australian Research Council through the ICT Centre of Excellence program., Sydney, Australia. {radwa.elshawi,joachim.gudmundsson}@nicta.com.au    Christos Levcopoulos Department of Computer Science, Lund University. christos@cs.lth.se
Abstract

This paper considers the problem of finding a quickest path between two points in the Euclidean plane in the presence of a transportation network. A transportation network consists of a planar network where each road (edge) has an individual speed. A traveller may enter and exit the network at any point on the roads. Along any road the traveller moves with a fixed speed depending on the road, and outside the network the traveller moves at unit speed in any direction.

We give an exact algorithm for the basic version of the problem: given a transportation network of total complexity in the Euclidean plane, a source point and a destination point , find a quickest path between and . We also show how the transportation network can be preprocessed in time into a data structure of size such that a -approximate quickest path cost queries between any two points in the plane can be answered in time .

1 Introduction

Transportation networks are a natural part of our infrastructure. We use bus or train in our daily commute, and often walk to connect between networks or to our final destination.

A transportation network consists of a set of non-intersecting roads, where each road has a speed. Thus a transportation network is usually modelled as a plane graph in the Euclidean plane (or some other metric) whose vertices are nodes and whose edges are roads. Furthermore, each edge has a weight assigned to it. One can access or leave a road through any point on the road. In the presence of a transportation network, the distance between two points is defined to be the shortest elapsed time among all possible paths joining the two points using the roads of the network. The induced distance, called , is called a transportation distance.

Using these notations the problem at hand is as follows:

Figure 1: Illustrating a quickest path from a source point to a destination point .
Problem 1

Given two points and in and a transportation network in the Euclidean plane. The problem is to find a path with the smallest transportation distance from to , as shown in Fig. 1.

Most of the previous research has focussed on shortest paths and Voroni diagrams. Abellanas et al. [1, 2] started work in this area considering the Voronoi diagram of a point set and shortest paths given a horizontal highway under the -metric and the Euclidean metric. Aichholzer et al. [4] introduced the city metric induced by the -metric and a highway network that consists of a number of axis-parallel line segments. They gave an efficient algorithm for constructing the Voronoi diagram and a quickest path map for a set of points given the city metric. Görke et al. [14] and Bae et al. [5] improved and generalised these results.

In the case when the edges can have arbitrary orientation and speed, Bae et al. [6] presented algorithms that compute the Voronoi diagram and shortest paths. They gave an algorithm for Problem 1 that uses time and space. This result was recently extended to more general metrics including asymmetric convex distance functions [7].

In this paper we improve on the results by Bae et al. [6] and give an time algorithm using space. Furthermore, we introduce the (approximate) query version. That is, a transportation network with roads in the Euclidean plane can be preprocessed in time into a data structure of size such that given any two points and in the plane a -approximate quickest path between and can be answered in time. For the query structure we assume that the minimum and maximum weights, and , are constants in the interval independent of , the exact bound is stated in Theorem 4.6.

This paper is organized as follows. Next we prove three fundamental properties about an optimal path among a set of roads. Then, in Section 3, we show how we can use these properties to build a graph of size that models the transportation network, a source point , a destination point and, contains a quickest path between and . In Section 4 we consider the query version of the problem. That is, preprocess the input such that an approximate quickest path query between two query points and can be answered efficiently. Finally, we conclude with some remarks and open problems.

2 Three Properties of an Optimal Path

In this section we are going to prove three important properties of an optimal path. The properties will be used repeatedly in the construction of the algorithms in Sections  3 and 4. Consider an optimal path and let be the sequence of roads that are encountered and followed in order along , that is, the sequence of roads on which the path changes direction. For example, in Fig. 1 that sequence would be but not include since the path does not follow . For any path , let denote the cost of the path . Note that a road can be encountered, and followed, several times by a path. For each road let and be the first and last point on encountered for each occasion by . Without loss of generality, we assume that lies below when studying two consecutive roads in . We have:

Property 1

For any two consecutive roads and in the subpath of between and is the straight line segment .

The endpoints of a road are denoted start point () and end point (), as they appear along the road direction.

Consider a segment connecting two consecutive roads and along . Let denote the angle , as illustrated in Fig. 2(a).

Property 2

If lies in the interior of then .

Proof

For simplicity rotate such that is horizontal and lies below , as shown in Fig. 2(a). Let denote the orthogonal projection of onto the ray containing (not necessarily on and let . We have:

Thus, the cost of the path from to along as a function of is:

Differentiating the above function with respect to gives:

Setting the resulting function gives that the minimum weight path between and along is obtained when

Property 3

There exists an optimal path of total cost with that fulfills Properties 1-2 such that for any two consecutive roads and in the straight-line segment of must have an endpoint at an endpoint of or , respectively.

Proof

Assume the opposite, i.e., does not coincide with any of the endpoints of or . Consider the three segment path from to , that is, , and . The length of this path is:

According to Lemma 2 the orientation of is fixed, which implies that the weight of the path is a linear function only depending on the position of (or ). Hence, moving in one direction will monotonically increase the weight of the path until one of two cases occur: (1) either or encounters an endpoint of or , or (2) or . If (1) then we have a contradiction since we assumed did not coincide with any endpoint. And if (2) then we have a contradiction since must follow both and (again from the definition of ).

Figure 2: (a) Illustrating Property 2. (b) Defining and (c) .

3 The basic case

In this section we consider Problem 1, that is, as input we are given a source point , a destination point and a transportation network and the aim is to find a path with minimum transportation distance from to . Our algorithm will construct a graph that models the set of roads and quickest paths between the roads. Using the three properties shown in the previous section we will show that if a shortest path in between and  has cost then an optimal path between and has cost . The optimal path can then be found by running Dijkstra’s algorithm [13] on .

Fix an optimal path that fulfills Properties 1-3 (we know such a path exists). If follows  and then the path between and (a) is a straight line segment, (b) the segment forms a fixed angle with , and (c) at least one of its endpoints coincides with an endpoint of or . These three properties suggest that has a very restricted structure which we will try to take advantage of.

Let be the projection of a point onto a road , if it exists, such that the angle is , as shown in Fig. 2(b). Furthermore, let be the projection of point on a road , if it exists, such that the angle is , as shown in Fig. 2(c).

Consider the graph with vertex set and edge set . Initially and are empty. The graph is defined as follows:

  1. Add and as vertices to .

  2. Add the nodes in as vertices to .

  3. For every road add the point (if it exists) as a vertex to and add the directed edge (if it exists) with weight to , see Fig. 3(a).

  4. For every road add the point (if it exists) as a vertex to and add the directed edge (if it exists) with weight to .

  5. For every pair of roads add the following points (if they exist) as vertices to : , , and . Add the following four directed edges to (if their endpoints exist): , , and . The weight of an edge is equal to the Euclidean distance between its endpoints, see Fig. 3(b).

  6. For every pair of roads add the directed edges with weight and with weight to .

  7. For every road consider the vertices of that correspond to points on in order from to . For every consecutive pair of vertices along add a directed edge from to of weight , as shown in Fig. 3(c).

Figure 3: Illustrating how the graph is built.
Lemma 1

The graph contains vertices and edges and can be constructed in time .

Proof

For every pair of roads we construct a constant number of vertices and edges that are added to and , thus vertices and edges in total. For the first five steps of the construction the time to construct the vertices and edges is linear with respect to the size of the graph, since every edge and vertex can be constructed in constant time. In step 6 we need to sort vertices along each road, thus time in total.

The following observation follows immediately from the construction of the graph and Properties 1-3.

Observation 1

The shortest path between and in has cost if and only if the minimum transportation distance from to has cost .

By simply running Dijkstra’s algorithm [13], implemented using Fibonacci heaps, on gives the main result of this section.

Theorem 3.1

A path with minimum transportation distance between and can be computed in time using space.

3.1 Shortest paths among polygon obstacles

In this section we briefly discuss how the above algorithm can be generalised to the case when the plane contains polygonal obstacles. As input we are given a source point , a destination point , a transportation network in the Euclidean plane and a set of non-intersecting obstacles of total complexity .

Every edge of an obstacle can be viewed as an undirected road (or two directed edges) with associated cost function . Consequently, the edge connecting a road and an obstacle edge along the optimal path has the three properties described in Section 2. However, while constructing the graph we have to add one additional constraint, namely, no edge in can intersect an obstacle. According to these properties we are going to build the graph that models the set of roads and obstacles.

There are several methods to check if a segment intersects an obstacle [3, 12, 15]. We will use the data structure by Agarwal and Sharir [3] which has query time using preprocessing and space for . Using this structure with gives us the following results:

Lemma 2

The graph has size and can be constructed in time , where .

By simply running Dijkstra’s algorithm, implemented using Fibonacci heaps, on gives:

Theorem 3.2

A collision-free path with minimum transportation distance between and among can be computed in time using space, where .

4 Shortest Path Queries

In this section we turn our attention to the query version. That is, preprocess such that given any two points and in find a quickest path between and among effectively. We will present a data structure that returns an approximate quickest path. That is, given two query points and , and a positive real value , the data structure returns a path between  and having transportation distance at most times the cost of an optimal path between  and .

To simplify the description we will start (Sections 4.1-4.2) with the case when is already known in advance and we are only given the start point as a query. Then in Section 4.4 we generalize this to the case when both and are given as a query, and in Section 4.5 we show how one can improve the preprocessing time and space requirement using the well-separated pair decomposition.

Fix an optimal path that fulfills Properties 1-3 (we know such a path exists), and consider the first segment of . Obviously must be either a start/endpoint of a road (type 1) or an interior point of a road (type 2) such that and form an angle of (ignoring the trivial case when ). We will use this observation to develop an approximation algorithm. The idea is simple. Build a graph , as described in Section 3, with and as input. Compute the cost of the quickest path between and every vertex in . Now, given a query point , find a good vertex in to connect (either directly or via a -link path) to and then lookup the cost of the quickest path from to in . Obviously the problem is how to find a “good” vertex. In the next subsection we will select a constant number of candidate vertices such that we can guarantee that at least one of the vertices will be a “good” candidate, i.e., there exists a path, that fulfills Properties 1-3, from to via this vertex that has cost at most times the cost of an optimal path.

4.1 Finding good candidates: Type 1 and Type 2

Let denote the set of the endpoints (both start and end) of the roads in and let be the query point. As described above we will have two types to consider, and we will construct a set for the type 1 cases and a set for the type 2 cases. The first set, , is a subset of and the second set, , is a set of 3-tuples that will be used by the query process (described in Section 4.2) to calculate the quickest path.

4.1.1 Type 1:

For the point set we will use the same idea as is used in the construction of -graphs [17]. Partition the plane into a set of equal size cones, denoted , with apex at and spanning an angle of , as shown in Fig. 4a. For each cone the set contains a point , where is a point in whose orthogonal projection onto the bisector of is closest to . The following holds:

Lemma 3

Given a point set and a positive constant one can preprocess into a data structure of size in time such that given a query point the point set , of size at most , can be reported in time.

Proof

Given a direction and a point let denote the infinite ray originating at with direction , see Fig. 4b. Let be the cone with apex at , bisector and angle . It has been shown (see for example Section 4.1.2 in [17] or Lemma 2 in [10]) that can be preprocessed in time into a data structure of size such that given a query point in the plane the data structure returns the point in whose orthogonal projection onto is closest to in time. We have directions, thus the lemma follows.

Figure 4: (a) Partitioning the plane into cones. (b) Selecting the point whose orthogonal projection onto the bisector of .

4.1.2 Type 2:

It remains to construct the set of -tuples. Unfortunately the construction might look unnecessarily complicated but hopefully it will become clear, when we prove the approximation bound (Section 4.3) why we need this construction. Before constructing we need some basic definitions.

Let and be the maximum and minimum weight of the roads in . Partition the set of roads into a minimum number of sets, , such that the orientation of a road in is in , where . Partition each set , , into sets such that the weight of a road in is in .

For every , and , define two directions and as follows (see also Fig. 5a). Consider an infinite ray with orientation having weight . For simplicity we rotate the ray such that it is horizontal directed from left to right. Let be the direction of a ray originating from below such that and meet at an angle of . The direction is defined symmetrically but with a ray originating from above .

Given a point on a road let denote the nearest vertex of to along . Note that must lie between and the end point of .

Now, we are ready to construct . When given the query point construct the set as follows. For each , and , shoot a ray originating from in direction and one ray in direction . If hits a road in then let be the first road hit and let be the point hit on , as illustrated in Fig. 5b. The -tuple is added to . If hits a road in then let be the first road hit and let be the point hit on . The -tuple is added to .

Lemma 4

Given a transportation network with roads in the Euclidean plane and a positive constant one can preprocess in time into a data structure of size such that given a query point the set can be reported in time. The number of -tuples in is .

Proof

The preprocessing consists of two steps: (1) partitioning into the sets , and , and (2) preprocessing each set into a data structure that answers ray shooting queries efficiently.

The first part is easily done in time by sorting the roads first with respect to their orientation and then with respect to their weight.

The second step of the preprocessing can be done by building two trapezoidal maps and (also know as a vertical decomposition) of each set as follows (see Fig. 5c). Rotate such that is vertical and upward. Build a trapezoidal map of as described in Chapter 6.1 in [8]. Then preprocess to allow for planar point location. Note that every face in either is a triangle or a trapezoid, and the left and right edges of each face (if they exists) are vertical. The trapezoidal map can be computed in the same way by rotating such that is vertical and upward. The total time needed for this step is and it requires space.

When a query point is given, two ray shooting queries are performed for each set . However, instead we perform a point location in the trapezoidal maps and . Consider and let be the face in the map containing . The top edge of corresponds to the first road hit by a ray emanating from in direction . When is found we just add to the first vertex on in to the right of . The same process is repeated for . Performing the point location requires time per trapezoidal map, thus the total query time is .

Figure 5: (a) Illustrating the definition of and . (b) is the first point hit by the ray and is the nearest neighbour of along . (c) The trapezoidal map of a set and the query point .

4.2 The preprocessing and the query

In this section we will present the remaining data structure, define the preprocessing and show how a query is processed.

4.2.1 Preprocessing

In Section 3 we showed how to build a graph given two points and the transportation network . The first step of the preprocessing is to build a graph of and the destination point (without the source point). Next compute the shortest path from every vertex in to the vertex corresponding to . Since the complexity of is quadratic, this step can be done in time and space using Dijkstra’s algorithm111The SSSP has to be performed from on a graph where every edge has swapped direction.. The distances are saved in a matrix . Finally, we combine the above results with Lemmas 3 and 4 and get:

Theorem 4.1

The preprocessing requires time and space.

4.2.2 Query

As a query we are given a point in the plane. First we compute the two sets and . For each vertex in compute the quickest path via , that is, . The quickest among these paths is denoted . The -tuples in require slightly more computation. For each -tuple consider the path from to using and . The cost of the path can be calculated as , where is the weight of road . The quickest among these paths is denoted .

The quickest path among , and the direct path from to is then reported.

Theorem 4.2

A query can be answered in time .

Proof

As above we divide the analysis into two parts: type 1 and type 2.

Type 1: According to Lemma 3 the number of type 1 candidate points is at most and can be computed in time . Computing the cost of a quickest path for a point in can be done in constant time. Thus, the query time is .

Type 2: According to Lemma 4 the number of -tuples in is and can be computed in time . Each element in is then processed in time, thus in total.

Summing up we get the bound stated in the theorem.

4.3 Approximation bound

Consider an optimal path and let be the first segment of . According to Property 1 it is a straight-line segment. For any two points and along , let denote the cost of from to . Define to be the sector with apex at , bisector on , interior angle and radius , as shown in Fig. 6(a).

Lemma 5

Let be a positive constant. If then:

Proof

The proof will be shown in two steps: (1) first we prove that for every endpoint within the quickest path, denoted , from to using the segment has cost at most , and then (2) we prove that has cost at most . Combining the two parts proves the lemma.

Part 1: Consider any point within , and let denote the quickest path from to using the segment . We have:

Part 2: As above let be any endpoint of within , and let be the quickest path from to using the segment .

Consider the set as described in Section 4.1 and assume without loss of generality that lies in a cone . If there exists a point in such that then we are done since .

Otherwise, there must exist another point in such that and whose orthogonal projection onto the bisector of is closer to than the orthogonal projection of onto the bisector of .

In the last step we used that .

Now we can combine the two results as follows.

This completes the proof of the lemma.

Figure 6: (a) Illustrating the definition of . (b) Illustrating the setting in Lemma 6.
Lemma 6

Let be positive constants. If then:

Proof

As above let be the first segment of , where lies on a road . Assume w.l.o.g. that is belongs to the set of roads as defined in Section 4.1(Type 2). Rotate the input such that is horizontal, below and going from right to left. Consider the construction of the -tuples in Type 2, and let be the -tuple reported when was processed in the direction towards . See Fig. 7(b).

Consider the shortest path from to using the segment . We will have two cases depending on : either (1) and lie on the same road, or (2) they lie on different roads.

Case 1: If and both lie on road (with cost function ) then we have:

That completes the first part.

Part 2: If and lie on different roads and , respectively, then must lie between and . This follows from the fact that does not contain any endpoints and is the first road hit. Furthermore, there must exist a an edge such that lies on to the left of and lies on to the right of and . See Fig. 7(b) for an illustration of case 2(a).

Consider the situation as depicted in Fig. 7(b). We will prove that the cost of the path from to via and is almost the same as the cost of the optimal path from to (that goes via . Recall that the cost function of and is and the cost function of is . Furthermore, let be the intersection point between and .

Note that the cost of the path from to via is maximized if forms an angle of with the horizontal line and lies above , as shown in Fig. 7(b). Furthermore, and .

Putting together the bounds we get:

This completes the proof of Lemma 6.

Figure 7: Illustrating (a) Case 1 and Case 2 (b) in the proof of Lemma 6.

We can summarize this section (Lemmas  5 and  6, Theorems  4.1 and  4.2) with the following theorem:

Theorem 4.3

Given a transportation network with roads in the Euclidean plane, a destination point and a positive constant , one can preprocess and in time and space such that given a query point , a -approximate quickest path can be calculated in time.

4.4 General case

In this section we turn our attention to the query version when we are given two query points and in and our goal is to find a quickest path between and among . The idea is the same as in the previous section. That is we perform the exact same preprocessing steps as in the previous section (omitting the destination point ), but with the exception that contains all-pair shortest distances. Using Johnson’s algorithm [16] the all-pairs shortest paths can be computed in using space.

Given a query we compute the two candidate sets of type 1 and type 2 for both and . For each pair of elements and compute a path between and as follows:

if and then

if and then

if and then

if and then

Note that for a specific pair the calculated distance might not be a good approximation of the actual distance. However, for the shortest path there exists a pair such that the distance is a good approximation.

By putting together the results, we obtain the following theorem:

Theorem 4.4

Given a transportation network