-
Notifications
You must be signed in to change notification settings - Fork 7.7k
sys: Add Disjoint-set (union-find) data structure #93300
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
base: main
Are you sure you want to change the base?
Conversation
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.
New features should have test cases added.
f37ab3c
to
8583e82
Compare
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.
Design note on the pointer handling.
Also count me on team sys_set_
. "uf
" is an expression of deep exasperation.
include/zephyr/sys/uf.h
Outdated
*/ | ||
struct uf_node { | ||
/** @cond INTERNAL_HIDDEN */ | ||
struct uf_node *parent; |
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.
This looks suspiciously like an slist, no? Not like linked list handling is that big a deal, but every byte of code savings helps.
de9abc2
to
f7d79b5
Compare
Add a set of Disjoint-set functions (`find`, `union`) to handle queries between sets. Signed-off-by: James Roy <[email protected]>
Add unit tests for functions (`sys_set_makeset`, `sys_set_union` and `sys_set_find`). Signed-off-by: James Roy <[email protected]>
* Utilities | ||
|
||
* :c:struct:`set_node` | ||
* :c:func:`sys_set_makeset` | ||
* :c:func:`sys_set_find` | ||
* :c:func:`sys_set_union` |
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.
Please put it in between the zephyr-keep-sorted
comments.
|
Add a set of Disjoint-set functions (
find
,union
) to handle queries between sets.