[PATCH] D40427: [ADT] Introduce Disjoint Set Union structure

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 26 20:57:54 PST 2017


mkazantsev added inline comments.


================
Comment at: include/llvm/ADT/DisjointSetUnion.h:105
+  // Memorizes calculated ranks of head vertices.
+  DenseMap<T, int> Rank;
+};
----------------
mkazantsev wrote:
> sanjoy wrote:
> > How about just one `DenseMap` that maps `T` instances to a `std::pair<T, int>`?
> That would consume as twice as much memory. We only store Rank for roots and Parent for non-roots, and this would have us store both for both.
We could store a union, though...


https://reviews.llvm.org/D40427





More information about the llvm-commits mailing list