Display program code

unionfind_opt.pl : Union find (optimised)
Optimised union-find implementation.
A new set can be created, sets can be united, and the representative for a set can be searched.

How to use:
The following operations are supported:
make(A): create a new set with single element A
find(A,B): B is representative of the set containing A
union(A,B): join the two sets containing A and B
link(A,B): join the two sets represented by A and B (internal)
Data is represented as:
root(A,N): A is the representative of a set (root of tree with depth N)
A ~> B: A and B are in the same set (edge indirectly pointing to root)

See also:
T Schrijvers, T Fruehwirth. Optimal union-find in Constraint Handling Rules. Theory and Practice of Logic Programming, 2006.

Program: Change the code, then submit!

Console: Enter query or select example from below, then submit and wait for answer!

Select example query: 

WebCHR help - CHR Website - (c) Copyrights Martin Kaeser Uni Ulm 2007