STL中的Union-Find(或Disjoint Set)数据结构?

Rit*_*was 9 c++ stl disjoint-sets union-find

我本来期望这样一个有用的数据结构被包含在内,C++ Standard Library但我似乎无法找到它.

Nir*_*man 6

它不是,但有一个提升:http://www.boost.org/doc/libs/1_64_0/libs/disjoint_sets/disjoint_sets.html,所以如果你想要一个现成的实现,我建议这个.

  • 没有文档,它在典型的 Boost 风格中是超通用的,但是 [this answer](/sf/answers/289524091/) 和 [this answer](https://stackoverflow.com/a/ 4136546/265521)给出如何使用它的想法。 (2认同)