Hostname: page-component-cd9895bd7-7cvxr Total loading time: 0 Render date: 2024-12-23T12:10:03.951Z Has data issue: false hasContentIssue false

Optimal union-find in Constraint Handling Rules

Published online by Cambridge University Press:  27 January 2006

TOM SCHRIJVERS
Affiliation:
Department of Computer Science, K. U. Leuven, Belgium (e-mail: www.cs.kuleuven.ac.be/~toms/)
THOM FRÜHWIRTH
Affiliation:
Faculty of Computer Science, University of Ulm, Germany (e-mail: www.informatik.uni-ulm.de/pm/mitarbeiter/fruehwirth/)

Abstract

Constraint Handling Rules (CHR) is a committed-choice rule-based language that was originally intended for writing constraint solvers. In this paper we show that it is also possible to write the classic union-find algorithm and variants in CHR. The programs neither compromise in declarativeness nor efficiency. We study the time complexity of our programs: they match the almost-linear complexity of the best known imperative implementations. This fact is illustrated with experimental results.

Type
Programming Pearl
Copyright
2006 Cambridge University Press

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)