ABSTRACT
Regular path queries (RPQs) select vertices connected by some path in a graph. The edge labels of such a path have to form a word that matches a given regular expression. We investigate the evaluation of RPQs with an additional constraint that prevents multiple traversals of the same vertices. Those regular simple path queries (RSPQs) quickly become intractable, even for basic languages such as (aa)* or a*ba*.
In this paper, we establish a comprehensive classification of regular languages with respect to the complexity of the corresponding regular simple path query problem. More precisely, we identify for which languages RSPQs can be evaluated in polynomial time, and show that evaluation is NP-complete for languages outside this fragment. We thus fully characterize the frontier between tractability and intractability for RSPQs, and we refine our results to show the following trichotomy: evaluation of RSPQs is either AC0 , NL-complete or NP-complete in data complexity, depending on the language L. The fragment identified also admits a simple characterization in terms of regular expressions.
Finally, we also discuss the complexity of deciding whether a language L belongs to the fragment above. We consider several alternative representations of L: DFAs, NFAs or regular expressions, and prove that this problem is NL-complete for the first representation and PSPACE-complete for the other two. As a conclusion we extend our results from edge-labeled graphs to vertex-labeled graphs.
- S. Abiteboul and V. Vianu. Regular path queries with constraints. J. Comput. Syst. Sci., 58(3):428--452, 1999. Google Scholar
Digital Library
- N. Alon, R. Yuster, and U. Zwick. Color-Coding. J. ACM, 42(4):844--856, 1995. Google Scholar
Digital Library
- M. Arenas, S. Conca, and J. Pérez. Counting beyond a yottabyte, or how sparql 1.1 property paths will prevent adoption of the standard. In WWW, pages 629--638, 2012. Google Scholar
Digital Library
- E. M. Arkin, C. H. Papadimitriou, and M. Yannakakis. Modularity of Cycles and Paths in Graphs. J. ACM, 38(2):255--274, 1991. Google Scholar
Digital Library
- G. Bagan, A. Bonifati, and B. Groz. A trichotomy for regular simple path queries on graphs. CoRR, abs/1212.6857, 2012.Google Scholar
- P. Barceló, L. Libkin, and J. L. Reutter. Querying graph patterns. In PODS, pages 199--210. ACM, 2011. Google Scholar
Digital Library
- C. L. Barrett, R. Jacob, and M. V. Marathe. Formal-language-constrained path problems. SIAM Journal on Computing, 30(3):809--837, 2000. Google Scholar
Digital Library
- D. Berwanger, A. Dawar, P. Hunter, S. Kreutzer, and J. Obdrzálek. The dag-width of directed graphs. J. Comb. Theory, Ser. B, 102(4):900--923, 2012. Google Scholar
Digital Library
- D. Calvanese, G. D. Giacomo, M. Lenzerini, and M. Y. Vardi. Answering regular path queries using views. In ICDE, pages 389--398, 2000. Google Scholar
Digital Library
- D. Calvanese, G. D. Giacomo, M. Lenzerini, and M. Y. Vardi. Rewriting of regular expressions and regular path queries. J. Comput. Syst. Sci., 64(3):443--465, 2002.Google Scholar
Digital Library
- D. Calvanese, G. D. Giacomo, M. Lenzerini, and M. Y. Vardi. Reasoning on regular path queries. SIGMOD Record, 32(4):83--92, 2003. Google Scholar
Digital Library
- D. Calvanese, G. D. Giacomo, M. Lenzerini, and M. Y. Vardi. An automata-theoretic approach to regular xpath. In DBPL, pages 18--35, 2009. Google Scholar
Digital Library
- B. Courcelle. Graph rewriting: An algebraic and logic approach. In Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics (B), pages 193--242. 1990. Google Scholar
Digital Library
- I. F. Cruz, A. O. Mendelzon, and P. T. Wood. A graphical query language supporting recursion. In SIGMOD Conference, pages 323--330, 1987. Google Scholar
Digital Library
- W. Fan, J. Li, S. Ma, N. Tang, and Y. Wu. Adding regular expressions to graph reachability and pattern queries. In ICDE, pages 39--50. IEEE Computer Society, 2011. Google Scholar
Digital Library
- J. Flum and M. Grohe. Parameterized Complexity Theory (Texts in Theoretical Computer Science. An EATCS Series). 2006. Google Scholar
Digital Library
- M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman, 1979. Google Scholar
Digital Library
- C. Gutierrez, C. A. Hurtado, A. O. Mendelzon, and J. Pérez. Foundations of semantic web databases. J. Comput. Syst. Sci., 77(3):520--541, 2011. Google Scholar
Digital Library
- R. H. Gäting. GraphDB: A Data Model and Query Language for Graphs in Databases. In Proc. 20th Int. Conf. on Very Large Data Bases, pages 297--308, 1994. Google Scholar
Digital Library
- P. Hunter and S. Kreutzer. Digraph measures: Kelly decompositions, games, and orderings. Theor. Comput. Sci., 399(3):206--219, 2008. Google Scholar
Digital Library
- N. Immerman. Nondeterministic space is closed under complementation. SIAM J. Comput., 17(5):935--938, 1988. Google Scholar
Digital Library
- N. Immerman. Descriptive complexity. Springer, 1999.Google Scholar
Cross Ref
- R. Jin, H. Hong, H. Wang, N. Ruan, and Y. Xiang. Computing label-constraint reachability in graph databases. In SIGMOD Conference, pages 123--134, 2010. Google Scholar
Digital Library
- T. Johnson, N. Robertson, P. D. Seymour, and R. Thomas. Directed tree-width. J. Comb. Theory, Ser. B, 82(1):138--154, 2001. Google Scholar
Digital Library
- A. Koschmieder and U. Leser. Regular path queries on large graphs. In SSDBM, pages 177--194, 2012. Google Scholar
Digital Library
- A. S. Lapaugh and C. H. Papadimitriou. The even-path problem for graphs and digraphs. Networks}, 14(4):507--513, 1984.Google Scholar
- U. Leser. A query language for biological networks. In ECCB/JBI, page 39, 2005.Google Scholar
- L. Libkin and D. Vrgoc. Regular Path Queries on Graphs with Data. In ICDT 2012, pages 74--85, 2012. Google Scholar
Digital Library
- K. Losemann and W. Martens. The complexity of evaluating path expressions in sparql. In PODS, pages 101--112. ACM, 2012. Google Scholar
Digital Library
- A. O. Mendelzon and P. T. Wood. Finding Regular Simple Paths in Graph Databases. SIAM J. Comput., 24(6):1235--1258, 1995. Google Scholar
Digital Library
- Z. P. Nedev. Finding an Even Simple Path in a Directed Planar Graph. SIAM J. Comput., 29:685--695, 1999. Google Scholar
Digital Library
- Z. P. Nedev and P. T. Wood. A polynomial-time algorithm for finding regular simple paths in outerplanar graphs. J. Algorithms, 35(2):235--259, 2000. Google Scholar
Digital Library
- F. Olken. Graph data management for molecular biology. OMICS, 7(1):75--78, 2003.Google Scholar
Cross Ref
- C. H. Papadimitriou. Computational complexity. Addison-Wesley, 1994.Google Scholar
- N. Robertson and P. D. Seymour. Graph Minors .XIII. The Disjoint Paths Problem. J. Comb. Theory, Ser. B, 63(1):65--110, 1995. Google Scholar
Digital Library
- R. Ronen and O. Shmueli. Soql: A language for querying and creating data in social networks. In ICDE, pages 1595--1602, 2009. Google Scholar
Digital Library
- W. L. Ruzzo, J. Simon, and M. Tompa. Space-bounded hierarchies and probabilistic computations. J. Comput. Syst. Sci.}, 28(2):216--230, 1984.Google Scholar
- A. Schrijver. Finding k Disjoint Paths in a Directed Planar Graph. SIAM J. Comput., 23(4):780--788, 1994. Google Scholar
Digital Library
- M. P. Schützenberger. On finite monoids having only trivial subgroups. Information and Control, 8(2):190--194, 1965.Google Scholar
Cross Ref
- L. J. Stockmeyer and A. R. Meyer. Word problems requiring exponential time: Preliminary report. In STOC, pages 1--9, 1973. Google Scholar
Digital Library
- C. B. Ward and N. M. Wiegand. Complexity results on labeled shortest path problems from wireless routing metrics. Computer Networks, 54(2):208--217, 2010. Google Scholar
Digital Library
Index Terms
A trichotomy for regular simple path queries on graphs
Recommendations
Dichotomies for Evaluating Simple Regular Path Queries
Best of EDBT 2017, Best of EDBT 2018, Best of ICDT 2018 and Regular PapersRegular path queries (RPQs) are a central component of graph databases. We investigate decision and enumeration problems concerning the evaluation of RPQs under several semantics that have recently been considered: arbitrary paths, shortest paths, paths ...
The Complexity of Regular Trail and Simple Path Queries on Undirected Graphs
PODS '22: Proceedings of the 41st ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database SystemsWe study the data complexity of regular trail and simple path queries on undirected graphs. Using techniques from structural graph theory, ranging from the graph minor theorem to group-labeled graphs, we are able to identify several tractable and ...
Polynomial Time Algorithms for Tracking Path Problems
AbstractGiven a graph G, and terminal vertices s and t, the Tracking Paths problem asks to compute a set of minimum number of vertices to be marked as trackers, such that the sequence of trackers encountered in each - path is unique. Tracking Paths is ...






Comments