Repository navigation
Collapse inner loops with union-find during WTO construction #9218
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
383c406
Collapse inner loops with union-find during WTO construction
tlively ec7e4ab
Merge branch 'domtree-block-indices' into wto-union-find
tlively 268e04d
Merge branch 'domtree-block-indices' into wto-union-find
tlively 25ec057
Merge branch 'domtree-block-indices' into wto-union-find
tlively bc37c1f
Merge branch 'domtree-block-indices' into wto-union-find
tlively 939de33
Merge branch 'domtree-block-indices' into wto-union-find
tlively a2089ff
Merge branch 'domtree-block-indices' into wto-union-find
tlively a3bbfbc
more comments on ufParent
tlively File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does union-find mean disjoint sets? If so, where is that data structure, since I don't seem to see this PR add one? And what is a "forest" of such things?
I feel like there is a bunch of concepts here without a large explanatory comment, or have I missed the forest for the trees 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, "union-find forest" and "disjoint sets" are two names for the same abstract data structure and algorithm. We have support/disjoint_sets.h, but we don't use it here because it is simpler and more efficient to just rearrange the existing references between entries into the union-find structure.
I can add a comment redirecting the reader to support/disjoint_sets.h to read about the algorithm, if you think that would help? Although that just links to wikipedia, so maybe better to link there directly: https://en.wikipedia.org/wiki/Disjoint-set_data_structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am more looking for a comment saying where the disjoint-set implementation is here. This doesn't add new data structures, so seemingly it was here all along, and this PR just "reinterprets" something existing? I'm not sure where to look for that.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the only structural element in the data structure is each item's parent pointer. An item's parent pointer is unset if the item is the representative element of its set, and otherwise there is a path of parent pointers leading to the representative element for the set. So this
ufParentis the entire data structure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is what I was looking for in a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'll update the code comment to say something like that.