Skip to content

Please add Union-Find #135

Description

@pitr

Suggested additional code entry (required)

I {p←⍺ ⋄ p⊣{p[⍵]←⍺}⍥({p[⍵]}⍣≡)/¨⍵} Xv

Description (required)
Union-find (aka disjoint-set, merge–find) algorithm to merge sets (represented as trees). I is a parent vector. Xv is a vector of tuples representing vertices to merge. Returns a parent vector with those vertices merged.

Class (optional)
Tacit

Type (optional)
Monadic Function

Group (optional)
Dyadic Operator, Monadic Operator

Category (required)
Sets, Trees

Keywords (optional)
union-find disjoint-set merge–find

TIO (optional)
Try it online URL


Note: By submitting this issue, you permit your contribution to be used without restriction.

Activity

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

Metadata

Metadata

Assignees

Labels

additionRequest additional content

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions