Skip to content

Commit

Permalink
feat: try std::sets instead of std::vectors to store adjacent blocks …
Browse files Browse the repository at this point in the history
…in the delta gc
  • Loading branch information
DanielSeemaier committed May 7, 2024
1 parent b604744 commit 2c8e2e7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions kaminpar-shm/refinement/gains/dense_gain_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <google/dense_hash_map>
#include <limits>
#include <set>

#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
Expand Down Expand Up @@ -701,11 +702,7 @@ template <typename _DeltaPartitionedGraph, typename _GainCache> class LargeKDens
_gain_cache_delta[index(v, block_from)] -= weight;

if (_gain_cache.conn(v, block_to) == 0 && conn_delta(v, block_to) == 0) {
auto &additional_blocks = _adjacent_blocks_delta[v];
if (std::find(additional_blocks.begin(), additional_blocks.end(), block_to) ==
additional_blocks.end()) {
additional_blocks.push_back(block_to);
}
_adjacent_blocks_delta[v].insert(block_to);
}

_gain_cache_delta[index(v, block_to)] += weight;
Expand Down Expand Up @@ -734,6 +731,6 @@ template <typename _DeltaPartitionedGraph, typename _GainCache> class LargeKDens
BlockID _k;
const GainCache &_gain_cache;
DynamicFlatMap<std::size_t, EdgeWeight> _gain_cache_delta;
google::dense_hash_map<NodeID, std::vector<BlockID>> _adjacent_blocks_delta;
google::dense_hash_map<NodeID, std::set<BlockID>> _adjacent_blocks_delta;
};
} // namespace kaminpar::shm

0 comments on commit 2c8e2e7

Please sign in to comment.