14 #ifndef OR_TOOLS_ALGORITHMS_DYNAMIC_PERMUTATION_H_
15 #define OR_TOOLS_ALGORITHMS_DYNAMIC_PERMUTATION_H_
25 class SparsePermutation;
38 int Size()
const {
return image_.size(); }
47 void AddMappings(
const std::vector<int>& src,
const std::vector<int>& dst);
67 const std::vector<int>&
AllMappingsSrc()
const {
return mapping_src_stack_; }
83 const std::set<int>&
LooseEnds()
const {
return loose_ends_; }
94 std::vector<int> image_;
97 std::vector<int> ancestor_;
102 std::vector<int> mapping_src_stack_;
103 std::vector<int> mapping_src_size_stack_;
106 std::set<int> loose_ends_;
110 mutable std::vector<bool> tmp_mask_;
125 const int j = ancestor_[i];
126 if (j == i)
return i;
133 #endif // OR_TOOLS_ALGORITHMS_DYNAMIC_PERMUTATION_H_