explanation of this algorithm
function equivalence(m,n)
//n variables,m equivalence relations
//bit is a boolean array
//seq is an array of pointers each one is pointing to the list of elements called equivalence elements
for i = i to n do seq(i)<-bit(i)<-0;
for k=1 to m do
[read-next pair(i,j)
getnode(x);
data(x)<-j;
link(x)<-seq(i);
seq(i)<-x;
getnode(x);
data(x)<-i;
link(x)<-seq(j);
seq(j)<-x;
]
index<-1
repeat
if bit(index)=0 then
[
print ("new equivalence class",index)
bit(index)<- 1;
ptr<-seq(index);
top<- 0
loop
while ptr(!= 0)
do
[j<-data(ptr)
if bit(j)= 0 then
[print(j);
bit(j)<-1
t<-link(ptr)
link(ptr)<- top
top<-ptr
ptr<-t;]
else
ptr<-link(ptr)
]//end while
ptr<-seq(data(top))
top<-link(top)
forever]
if bit(index)=0
index<-index + 1;
until index>w
end