-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DisjointSets: template for extension? #911
Comments
|
Ah good call about sum/count for precision, thanks! In terms of template, what I meant to ask was: should I write a new I guess if I'm tracking size, I can do union-by-size and eliminate Also, another question I have is related to an earlier discourse post of mine: would implementing path-compression + splitting/halving be something worth considering? Maybe I'll close this issue and put the path-compression+splitting question in another issue. |
Hi @jacob-roth, sorry missed your reply. I answered your question on Discourse. Yes, go ahead for a PR implementing path-compression. Make sure to benchmark it. |
I have an application where I need to extend the functionality of
IntDisjointSets
. In one use case, I need to handle the following:My first thought was to allocate additional arrays for
min
,max
,count
, andavg
and then modifyroot_union!
in the following way, based on 298:I was wondering (1) if there might be any optimizations to this code and (2) if it could be useful for having a template indicating how to best modify the functionality of disjoint sets? My actual use case is slightly more complicated than this, but if this is a "good" template for min/max/avg, then I will follow it for my use case.
The text was updated successfully, but these errors were encountered: