Skip to main content

Quasi-Linear-Time Algorithms by Generalisation of Union-Find in CHR

  • Conference paper
Recent Advances in Constraints (CSCLP 2007)

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 5129))

Abstract

The union-find algorithm can be seen as solving simple equations between variables or constants. With a few lines of code change, we generalise its implementation in CHR from equality to arbitrary binary relations. By choosing the appropriate relations, we can derive fast incremental algorithms for solving certain propositional logic (SAT) problems and polynomial equations in two variables. In general, we prove that when the relations are bijective functions, our generalisation yields a correct algorithm. We also show that bijectivity is a necessary condition for correctness if the relations include the identity function.

The rules of our generic algorithm have additional properties that make them suitable for incorporation into constraint solvers: from classical union-find, they inherit a compact solved form and quasi-linear time and space complexity. By nature of CHR, they are anytime and online algorithms. They solve and simplify the constraints in the problem, and can test them for entailment, even when the constraints arrive incrementally.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aspvall, B., Plass, M.F., Tarjan, R.E.: A linear time algorithm for testing the truth of certain quantified Boolean formulas. Information Processing Letters 8, 121–123 (1979)

    Article  MathSciNet  MATH  Google Scholar 

  2. Aspvall, B., Shiloach, Y.: A fast algorithm for solving systems of linear equations with two variables per equation. Linear Algebra and its Applications 34, 117–124 (1980)

    Article  MathSciNet  MATH  Google Scholar 

  3. Beeri, C., Bernstein, P.A.: Computational problems related to the design of normal form relational schemas. ACM Trans. Database Syst. 4(1), 30–59 (1979)

    Article  Google Scholar 

  4. Dowling, W.F., Gallier, J.H.: Linear-time algorithms for testing the satisfiability of propositional horn formulae. J. Log. Program. 1(3), 267–284 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  5. Duck, G.J., Stuckey, P.J., García de la Banda, M., Holzbaur, C.: The Refined Operational Semantics of Constraint Handling Rules. In: Demoen, B., Lifschitz, V. (eds.) ICLP 2004. LNCS, vol. 3132, pp. 90–104. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  6. Frühwirth, T., Abdennadher, S.: Essentials of Constraint Programming. Springer, Heidelberg (2003)

    Book  MATH  Google Scholar 

  7. Frühwirth, T.: Theory and Practice of Constraint Handling Rules, Special Issue on Constraint Logic Programming. Journal of Logic Programming 37(1–3), 95–138 (1998)

    Article  MathSciNet  MATH  Google Scholar 

  8. Frühwirth, T.: Deriving linear-time algorithms from union-find in chr. In: Schrijvers, T., Frühwirth, T. (eds.) Third Workshop on Constraint Handling Rules, Venice, Italy (July 2006)

    Google Scholar 

  9. Frühwirth, T.: Constraint Handling Rules. Cambridge University Press, Cambridge (to appear, 2008)

    MATH  Google Scholar 

  10. Galil, Z., Italiano, G.F.: Data Structures and Algorithms for Disjoint Set Union Problems. ACM Comp. Surveys 23(3), 319ff (1991)

    Article  Google Scholar 

  11. Joseph, B., Kruskal, J.B.: On the shortest spanning subtree of a graph and the traveling salesman problem. Proceedings of the American Mathematical Society 7, 48–50 (1956)

    Article  MathSciNet  MATH  Google Scholar 

  12. Minoux, M.: LTUR: a simplified linear-time unit resolution algorithm for Horn formulae and computer implementation. Information Processing Letters 29(1), 1–12 (1988)

    Article  MathSciNet  MATH  Google Scholar 

  13. Schrijvers, T., Frühwirth, T.: Analysing the CHR Implementation of Union-Find. In: 19th Workshop on (Constraint) Logic Programming (W(C)LP 2005), Ulmer Informatik-Berichte 2005-01, University of Ulm, Germany (February 2005)

    Google Scholar 

  14. Schrijvers, T., Frühwirth, T.: Optimal union-find in constraint handling rules, programming pearl. Theory and Practice of Logic Programming (TPLP) 6(1) (2006)

    Google Scholar 

  15. Sneyers, J., Schrijvers, T., Demoen, B.: The Computational Power and Complexity of Constraint Handling Rules. In: Second Workshop on Constraint Handling Rules, at ICLP 2005, Sitges, Spain (October 2005)

    Google Scholar 

  16. Tarjan, R.E., van Leeuwen, J.: Worst-case Analysis of Set Union Algorithms. J. ACM 31(2), 245–281 (1984)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2008 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Frühwirth, T. (2008). Quasi-Linear-Time Algorithms by Generalisation of Union-Find in CHR. In: Fages, F., Rossi, F., Soliman, S. (eds) Recent Advances in Constraints. CSCLP 2007. Lecture Notes in Computer Science(), vol 5129. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-89812-2_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-89812-2_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-89811-5

  • Online ISBN: 978-3-540-89812-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics