Shortest path queries are ubiquitous in many spatial applications. Existing solutions assign numerical weights to edges and compute the path with the minimum sum of edge weights. However, in practice, the road categories associated with edges (e.g., toll) can make shortest paths undesirable, e.g., they may use unfavorable toll roads. Augmenting each edge with a label to denote its category, we study the Label-Constrained Shortest Path (LCSP) query that finds the shortest path under the constraint that the edge labels along the path should follow a pattern expressed by a formal language. There have been extensive LCSP solutions, but they are either inefficient in query processing or limited to special languages with low expressiveness capacity. In this paper, we propose the index called Partially Constrained Shortest Path (PCSP), which answers each query quickly by concatenating two shortest paths that partially satisfy the constraint and support more general regular languages. We also present pruning techniques that further optimize query efficiency. Experimental comparison with the state-of-the-art index demonstrates the superiority of PCSP. It can answer each LCSP query in around 100 microseconds and runs faster than the best-known solution by up to two orders of magnitude.
Read full abstract