Given an alphabet , a (directed) graph G whose edges are weighted and -labeled, and a formal language L , the formal-language-constrained shortest/simple path problem consists of finding a shortest (simple) path p in G complying with the additional constraint that l(p) L. Here l(p) denotes the unique word obtained by concatenating the -labels of the edges along the path p. The main contributions of this paper include the following: (1) We show that the formal-language-constrained shortest path problem is solvable efficiently in polynomial time when L is restricted to be a context-free language (CFL). When L is specified as a regular language we provide algorithms with improved space and time bounds. (2) In contrast, we show that the problem of finding a simple path between a source and a given destination is NP-hard, even when L is restricted to fixed simple regular languages and to very simple classes of graphs (e.g., complete grids). (3) For the class of treewidth-bounded graphs, w...
Christopher L. Barrett, Riko Jacob, Madhav V. Mara