Skip to main content

Solving Regular Path Queries

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2386))

Abstract

Regular path queries are a way of declaratively specifying program analyses as a kind of regular expressions that are matched against paths in graph representations of programs. These and similar queries are useful for other path analysis problems as well. This paper describes the precise specification, derivation, and analysis of a complete algorithm and data structures for solving regular path queries. We first show two ways of specifying the problem and deriving a high-level algorithmic solution, using predicate logic and language inclusion, respectively. Both lead to a set-based fixed-point specification. We then derive a complete implementation from this specification using Paige’s methods that consist of dominated convergence, finite differencing, and real-time simulation. This formal derivation allows us to analyse the time and space complexity of the implementation precisely in terms of size parameters of the graph and the deterministic finite automaton that corresponds to the regular expression. In particular, the time and space complexity is linear in the size of the graph. We also note that the problem is PSPACE-complete in terms of the size of the regular expression. In applications such as program analysis, the size of the graph may be very large, but the size of the regular expression is small and can be considered a constant.

This work was supported in part by ONR under grants N00014-01-1-0109 and N00014-99-1-0132.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. V. Aho, J. E. Hopcroft, and J. D. Ullman. Data Structures and Algorithms. Addison-Wesley, Reading, Mass., 1983.

    MATH  Google Scholar 

  2. J. Cai, P. Facon, F. Henglein, R. Paige, and E. Schonberg. Type analysis and data structure selection. In B. Möller, editor, Constructing Programs from Specifications, pages 126–164. North-Holland, Amsterdam, 1991.

    Google Scholar 

  3. J. Cai and R. Paige. Program derivation by fixed point computation. Sci. Comput. Program., 11:197–261, Sept. 1988/89.

    Google Scholar 

  4. C.-H. Chang and R. Paige. From regular expressions to DFA’s using compressed NFA’s. Theoret. Comput. Sci., 178(1–2):1–36, May 1997.

    Google Scholar 

  5. O. de Moor, D. Lacey, and E. V. Wyk. Universal regular path queires, Nov. 2001. Revised and being reviewed for Special Issue of Higher-Order and Symbolic Computation dedicated to Bob Paige.

    Google Scholar 

  6. D.-Z. Du and K.-I. Ko. Theory of Computational Complexity. John Wiley & Sons, 2000.

    Google Scholar 

  7. Y. A. Liu. Efficiency by incrementalization: An introduction. Higher-Order and Symbolic Computation, 13(4):289–313, Dec. 2000.

    Google Scholar 

  8. Z. Manna and R. Waldinger. The Deductive Foundations of Computer Programming. Addison-Wesley, Reading, Mass., 1993.

    MATH  Google Scholar 

  9. M. Müller-Olm, D. Schmidt, and B. Steffen. Model-checking: A tutorial introduction. In Proceedings of the 6th International Static Analysis Symposium, volume 1694 of Lecture Notes in Computer Science, pages 331–354. Springer-Verlag, Berlin, Sept. 1999.

    Google Scholar 

  10. R. Paige. Formal Differentiation: A Program Synthesis Technique, volume 6 of Computer Science and Artificial Intelligence. UMI Research Press, Ann Arbor, Michigan, 1981. Revision of Ph.D. dissertation, New York University, 1979.

    Google Scholar 

  11. R. Paige. Programming with invariants. IEEE Software, 3(1):56–69, Jan. 1986.

    Google Scholar 

  12. R. Paige. Real-time simulation of a set machine on a RAM. In Computing and Information, Vol. II, pages 69–73. Canadian Scholars Press, 1989. Proceedings of ICCI’ 89: The International Conference on Computing and Information, Toronto, Canada, May 23–27, 1989.

    Google Scholar 

  13. R. Paige. Viewing a program transformation system at work. In M. Hermenegildo and J. Penjam, editors, Proceedings of Joint 6th International Conference on Programming Languages: Implementations, Logics and Programs and 4th International Conference on Algebraic and Logic Programming, volume 844 of Lecture Notes in Computer Science, pages 5–24. Springer-Verlag, Berlin, Sept. 1994.

    Google Scholar 

  14. R. Paige and S. Koenig. Finite differencing of computable expressions. ACM Trans. Program. Lang. Syst., 4(3):402–454, July 1982.

    Google Scholar 

  15. J. T. Schwartz, R. B. K. Dewar, E. Dubinsky, and E. Schonberg. Programming with Sets: An Introduction to SETL. Springer-Verlag, Berlin, New York, 1986.

    MATH  Google Scholar 

  16. W. K. Snyder. The SETL2 Programming Language. Technical report 490, Courant nstitute of Mathematical Sciences, New York University, Sept. 1990.

    Google Scholar 

  17. R. E. Tarjan. Fast algorithms for solving path problems. J. ACM, 28(3):594–614, July 1981.

    Google Scholar 

  18. R. E. Tarjan. A unified approach to path problems. J. ACM, 28(3):577–593, July 1981.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2002 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Liu, Y.A., Yu, F. (2002). Solving Regular Path Queries. In: Boiten, E.A., Möller, B. (eds) Mathematics of Program Construction. MPC 2002. Lecture Notes in Computer Science, vol 2386. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45442-X_12

Download citation

  • DOI: https://doi.org/10.1007/3-540-45442-X_12

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-43857-1

  • Online ISBN: 978-3-540-45442-7

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics