-
Notifications
You must be signed in to change notification settings - Fork 430
Description
Summary
UnionFind is missing the ability to add new sets (increasing the internal vectors' length) after creating the UnionFind.
Motivation
It's part of the standard disjoint-set data-structure operations. Also, without it it makes it very annoying when trying to transform some problem into a disjoint-set data-structure, where you incrementally add sets and union existing sets as you go along, since currently the API limitations requires you to convert that incremental algorithm into a 2-pass algorithm so you can calculate the length to pass into UnionFind::new, and then the second pass actually uses the UnionFind data-structure.
Details
- What code needs to change? New traits? Which modules?
Add a new method to UnionFind to add a new set and return the new set's index.
- Is this a new graph algorithm? Include links to papers, Wikipedia, or other
implementations of this algorithm that exist.
https://en.wikipedia.org/wiki/Disjoint-set_data_structure#Making_new_sets
- Are you willing to implement this yourself? Mentor someone else and help them
implement it?
I can implement this, it's pretty trivial...