Problems in many areas can be reduced to one of the formal-languages-constrained path problems. Conjunctive grammars are more expressive than context-free grammars and are used, for example, in static analysis to describe an interleaved matched-parentheses language, which is not context-free. Path querying with conjunctive grammars is known to be undecidable. There is an algorithm for path querying with linear conjunctive grammars which provides an over-approximation of the result, but there is no algorithm for arbitrary conjunctive grammars. We propose the first algorithm for path querying with arbitrary conjunctive grammars. The proposed algorithm is matrix-based and allows us to efficiently apply GPGPU (General-Purpose computing on Graphics Processing Units) computing techniques and other optimizations for matrix operations.
This is a preview of subscription content, access via your institution.
Buy single article
Instant access to the full article PDF.
Tax calculation will be finalised during checkout.
GitHub repository of the YaccConstructor project: https:// github.com/YaccConstructor/YaccConstructor.
The Math.Net Numerics WebSite: https://numerics.mathdotnet.com/.
GitHub repository of the managedCuda library: https://kunzmi.github.io/managedCuda/.
Barrett, Ch., Jacob, R., and Marathe, M., Formal-language-constrained path problems, SIAM J. Comput., 2000, vol. 30, no. 3, pp. 09–837.
Bastani, O., Anand, S., and Aiken, A., Specification inference using context-free language reachability, ACM SIGPLAN Notices, ACM, 2015, vol. 50, pp. 553–566.
Xu, G., Rountev, A., and Sridharan, M., Scaling c-reachability-based points-to analysis using context-sensitive must-not-alias analysis, ECOOP, Springer, 2009, vol. 9, pp. 98–122.
Reps, T., Program analysis via graph reachability, Inf. Software Technol., 1998, vol. 40, no. 11, pp. 701–726.
Zhang, Q. and Su, Z., Context-sensitive data-dependence analysis via linear conjunctive language reachability, Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, ACM, 2017, pp. 344–358.
Hellings, J., Conjunctive Context-Free Path Queries, 2014.
Azimov, R. and Grigorev, S., Context-free path querying by matrix multiplication, Proceedings of the 1st ACM SIGMOD Joint International Workshop on Graph Data Management Experiences and Systems (GRADES) and Network Data Analytics (NDA), ACM, 2018, p. 5.
Grigorev, S. and Ragozina, A., Context-free path querying with structural representation of result, Proceedings of the 13th Central and Eastern European Software Engineering Conference in Russia, ACM, 2017, p. 10.
Sevon, P. and Eronen, L., Subgraph queries by context-free grammars, J. Integrative Bioinformatics, 2008, vol. 5, no. 2, p. 100.
Zhang, X., Feng, Z., Wang, X., Rao, G., and Wu, W., Context-free path queries on rdf graphs, International Semantic Web Conference, Springer, 2016, pp. 632–648.
Okhotin, A., Conjunctive and boolean grammars: the true general case of the context-free grammars, Comput. Sci. Rev., 2013, vol. 9, pp. 27–59.
Okhotin, A., Conjunctive grammars, J. Automata, Languages,Combinatorics, 2001, vol. 6, no. 4, pp. 519–535.
Abiteboul, S. and Vianu, V., Regular path queries with constraints, Proceedings of the Sixteenth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, ACM, 1997, pp. 122–133.
Fan, W., Li, J., Ma, Sh., Tang, N., and Wu, Y., Adding regular expressions to graph reachability and pattern queries, Data Engineering (ICDE),2011IEEE 27th International Conference on, IEEE, 2011, pp. 39–50.
Nolé, M. and Sartiani, C., Regular path queries on massive graphs, Proceedings of the 28th International Conference on Scientific and Statistical Database Management, ACM, 2016, p. 13.
Reutter, J.L., Romero, M., and Vardi, M.Y., Regular queries on graph databases, Theory Comput. Systems, 2017, vol. 61, no. 1, pp. 31–83.
Kasami, T., An efficient recognition and syntax analysis algorithm for context-free languages, Technical report, DTIC Document, 1965.
Younger, D.H., Recognition and parsing of context-free languages in time n3, Information and Control, 1967, vol. 10, no. 2, pp. 189–208.
Grune, D. and Jacobs, C.J.H., Parsing Techniques (Monographs in Computer Science), NJ, USA, Secaucus: Springer-Verlag-New York, Inc., 2006.
Hellings, J., Querying for paths in graphs using context-free path queries, arXiv preprint arXiv:1502.02242, 2015.
Scott, E. and Johnstone, A., Gll parsing, Electronic Notes in Theoretical Computer Science, 2010, vol. 253, no. 7, pp. 177–189.
Syme, D., Granicz, A., and Cisternino, A., Expert F# 3.0, Springer, 2012.
Mendez-Lojo, M., Burtscher, M., and Pingali, K., A gpu implementation of inclusion-based points-to analysis, ACM SIGPLAN Notices, 2012, vol. 47, no. 8, pp. 107–116.
Yu Su, Ding Ye, and Jingling Xue, Accelerating inclusion-based pointer analysis on heterogeneous cpu-gpu systems, High Performance Computing (HiPC),201320th International Conference on, IEEE, 2013, pp. 149–158.
Yu Su, Ding Ye, Jingling Xue, and Xiang-Ke Liao, An efficient gpu implementation of inclusion-based pointer analysis, IEEE Transactions on Parallel and Distributed Systems, 2016, vol. 27, no. 2, pp. 353–366.
This work was supported by the Russian Science Foundation, grant no. 18-11-00100.
About this article
Cite this article
Azimov, R., Grigorev, S. Path Querying with Conjunctive Grammars by Matrix Multiplication. Program Comput Soft 45, 357–364 (2019). https://doi.org/10.1134/S0361768819070041
- conjunctive grammars
- path querying
- transitive closure
- static analysis
- matrix multiplication