9 explicit Frontier(std::size_t n = 0) : bitmap_(n, 0) {}
10 void reset(std::size_t n) { sparse_.clear(); bitmap_.assign(n, 0); }
11 void add(
VertexId v) {
if (!bitmap_[v]) { bitmap_[v] = 1; sparse_.push_back(v); } }
13 [[nodiscard]]
const std::vector<VertexId>&
sparse() const noexcept {
return sparse_; }
14 [[nodiscard]]
double density()
const {
return bitmap_.empty() ? 0.0 :
static_cast<double>(sparse_.size())/bitmap_.size(); }
17 std::vector<VertexId> sparse_;
18 std::vector<std::uint8_t> bitmap_;