Skip to content

Commit

Permalink
feat: use std::vector<> instead of std::set<>
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSeemaier committed May 8, 2024
1 parent 2c8e2e7 commit ce25a1d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions kaminpar-shm/refinement/gains/dense_gain_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

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

#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
Expand Down Expand Up @@ -702,7 +702,12 @@ 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) {
_adjacent_blocks_delta[v].insert(block_to);
auto &additional_adjacent_blocks = _adjacent_blocks_delta[v];
if (std::find(
additional_adjacent_blocks.begin(), additional_adjacent_blocks.end(), block_to
) == additional_adjacent_blocks.end()) {
additional_adjacent_blocks.push_back(block_to);
}
}

_gain_cache_delta[index(v, block_to)] += weight;
Expand Down Expand Up @@ -731,6 +736,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::set<BlockID>> _adjacent_blocks_delta;
google::dense_hash_map<NodeID, std::vector<BlockID>> _adjacent_blocks_delta;
};
} // namespace kaminpar::shm

0 comments on commit ce25a1d

Please sign in to comment.