Skip to content

AIDisjointSetNode union does not use rank or size heuristic #70

Description

@codewithzubair07

While exploring the implementation of AIKruskal I looked at the class AIDisjointSetNode.

The union operation currently attaches one root to another:

root1 := aDSNode find.
root2 := self find.
root1 = root2 ifTrue: [ ^ self ].
root1 parent: root2

The find method already performs path compression, but union does not appear to use rank or size heuristics.

It might be interesting to experiment with adding a rank field and implementing union-by-rank, then benchmarking its effect on algorithms such as Kruskal.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions