I'm doing a project based on hashtables and disjoint sets, while implementing the makeset function for the nodes i had a doubt about it. This is the pseuodocode of the makeset function (i'm using path compression and rank euristics):
Makeset(x)
{
x.parent = x;
x.rank = 0
}
This should make the set containing only the element x by theory. Now looking at this image:
If i call the makeset function on element 1 of the image, the set after the function has x as it's parent (as it already was before) but rank = 0, the problem is that the nodes connected to it (2,3,4 and 5 in the e.g) are still connected to it. Is this the right way to do this ? i followed the pseudocodes on cormen's algorithm introduction book.