graph icon indicating copy to clipboard operation
graph copied to clipboard

Link/Cut-Trees implementation

Open yi-ji opened this issue 5 years ago • 16 comments

This PR implements Link/Cut-Trees data structure for Boost Graph Library. Since disjoint_sets algorithms has been moved into boost/graph (#169), this should also be the right place to put link_cut_trees algorithm.

This implementation of link_cut_trees supports following operations:

  • make_tree(x): create a new link/cut-tree containing only root x
  • link(x, y): make the tree rooted at x a subtree of y;
  • cut(x): remove the edge connecting x to its parent;
  • find_root(x): find the root of the tree containing x;
  • lowest_common_ancestor(x, y): find the lowest common ancestor of such x and y that have same root.

All operations above are of amortized time complexity O(log n), except O(1) for make_tree.

This implementation refers to: Robert Endre Tarjan, Data Structures and Network Algorithms, Chapter 5

yi-ji avatar Sep 28 '19 05:09 yi-ji

I'm not sure that Boost.Graph really is the right place for disjoint_sets, but it definitely is the right place for link_cut_tree! I just have one question: how is the documentation going? :)

jeremy-murphy avatar Sep 29 '19 10:09 jeremy-murphy

@jeremy-murphy comments resolved, checks passed :)

yi-ji avatar Oct 09 '19 12:10 yi-ji

Hi @jeremy-murphy Thanks for reviewing! This PR has been ready for quite a while. Any concerns before merging it? Would appreciate someone with write access to have a look :) @jzmaddock

yi-ji avatar Jun 11 '20 03:06 yi-ji

Hey, sorry, I don't have much time for open-source projects now that I have a baby! I'll try to review again quickly.

jeremy-murphy avatar Jun 11 '20 04:06 jeremy-murphy

@jeremy-murphy Thanks for helping review again :smile: I've replied or made changes accordingly. Enjoy parenting! :baby_bottle:

yi-ji avatar Jun 21 '20 04:06 yi-ji

Hi @jeremy-murphy good sir, all comments resolved & checks passed, ready again :)

Hope this is not disturbing you @jzmaddock Would you mind having a look to help merge it? :))

yi-ji avatar Jun 24 '20 13:06 yi-ji

I can't merge it, sorry, I don't have that access. @jzmaddock is the only person I'm aware of with that access and is active at the moment.

jeremy-murphy avatar Oct 10 '20 06:10 jeremy-murphy

This has been lying in backlog for quite a while. @jzmaddock would you mind having a look? :)

yi-ji avatar Mar 09 '21 08:03 yi-ji

thanks for adding this! It seems that this data structure could not be serialized using Boost: Serialization?

xiuliren avatar Apr 14 '21 17:04 xiuliren

@jingpengw I guess it depends on the template parameters? All I know is that boost serialization supports POD and STL containers, I think you can use them to instantiate link-cut trees.

yi-ji avatar Jun 13 '21 13:06 yi-ji

@jzmaddock Could you please take a look at this MR when you've got time? It's ready for merge :) Thank you.

yi-ji avatar Aug 01 '21 15:08 yi-ji

@jzmaddock did you get a chance to take a look? is it good to merge?

xiuliren avatar Nov 11 '21 03:11 xiuliren

I need to get the CI fixed and I'm going to prioritize merging some bug fixes, but then one day I'll get back to you! ;)

jeremy-murphy avatar Dec 09 '21 05:12 jeremy-murphy

any chance to merge this?

xiuliren avatar Oct 25 '23 14:10 xiuliren

any chance to merge this?

Yes, there is a chance. :) I'll try to look over it again soon, but I can't guarantee anything.

jeremy-murphy avatar Oct 26 '23 23:10 jeremy-murphy

any chance to merge this?

Yes, there is a chance. :) I'll try to look over it again soon, but I can't guarantee anything.

Btw, what I meant is, I definitely want to merge it, it's just a matter of chance that I find time to do it. :)

jeremy-murphy avatar Oct 29 '23 22:10 jeremy-murphy