Use ArrayStorage for boundary nodes to optimize MLD

For the MLD algorithm we can partition the NodeID range into boundary
and non-boundary nodes. Since there are only we boundary nodes we can
use the ArrayStorage for those yielding much faster query times.
This commit is contained in:
Patrick Niklaus
2018-04-08 16:37:08 +00:00
committed by Patrick Niklaus
parent 7edf0f218c
commit bf2b45120a
12 changed files with 151 additions and 24 deletions
@@ -138,6 +138,14 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
// We save the level as sentinel at the end
LevelID GetNumberOfLevels() const { return node_to_edge_offset.back(); }
NodeID GetMaxBorderNodeID() const
{
auto num_levels = GetNumberOfLevels();
BOOST_ASSERT((node_to_edge_offset.size() - 1) % num_levels == 0);
auto max_border_node_id = (node_to_edge_offset.size() - 1) / num_levels - 1;
return max_border_node_id;
}
private:
template <typename ContainerT>
auto GetHighestBorderLevel(const MultiLevelPartition &mlp, const ContainerT &edges) const