#pragma once #include #include namespace libkaminpar { using NodeID = uint32_t; #ifdef KAMINPAR_64BIT_EDGE_IDS using EdgeID = uint64_t; #else // KAMINPAR_64BIT_EDGE_IDS using EdgeID = uint32_t; #endif // KAMINPAR_64BIT_EDGE_IDS using BlockID = uint32_t; using NodeWeight = int32_t; #ifdef KAMINPAR_64BIT_EDGE_WEIGHTS using EdgeWeight = int64_t; #else // KAMINPAR_64BIT_EDGE_WEIGHTS using EdgeWeight = int32_t; #endif // KAMINPAR_64BIT_EDGE_WEIGHTS using BlockWeight = NodeWeight; class Partitioner { friend class PartitionerBuilder; public: Partitioner(); ~Partitioner(); Partitioner &set_option(const std::string &name, const std::string &value); std::unique_ptr partition(BlockID k) const; std::unique_ptr partition(BlockID k, EdgeWeight &edge_cut) const; std::size_t partition_size() const; private: struct PartitionerPrivate *_pimpl; }; class PartitionerBuilder { public: PartitionerBuilder(const PartitionerBuilder &) = delete; PartitionerBuilder &operator=(const PartitionerBuilder &) = delete; PartitionerBuilder(PartitionerBuilder &&) noexcept = default; PartitionerBuilder &operator=(PartitionerBuilder &&) noexcept = default; ~PartitionerBuilder(); static PartitionerBuilder from_graph_file(const std::string &filename); static PartitionerBuilder from_adjacency_array(NodeID n, EdgeID *nodes, NodeID *edges); void with_node_weights(NodeWeight *node_weights); void with_edge_weights(EdgeWeight *edge_weights); Partitioner create(); Partitioner rearrange_and_create(); private: PartitionerBuilder(); private: struct PartitionerBuilderPrivate *_pimpl; }; } // namespace libkaminpar