From 4c65210d33a09aa718e123b1e59aa7300ea7b943 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Thu, 12 Apr 2018 13:51:23 +0200 Subject: [PATCH] Remove dummy edges before inplace permutation --- include/util/dynamic_graph.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/util/dynamic_graph.hpp b/include/util/dynamic_graph.hpp index 6fd599759e3..2a22aeae7c8 100644 --- a/include/util/dynamic_graph.hpp +++ b/include/util/dynamic_graph.hpp @@ -413,6 +413,11 @@ template class DynamicGraph util::inplacePermutation(node_array.begin(), node_array.end(), old_to_new_node); // Build up edge permutation + if (edge_list.size() >= std::numeric_limits::max()) + { + throw util::exception("There are too many edges, OSRM only supports 2^32" + SOURCE_REF); + } + EdgeID new_edge_index = 0; std::vector old_to_new_edge(edge_list.size(), SPECIAL_EDGEID); for (auto node : util::irange(0, number_of_nodes)) @@ -421,11 +426,6 @@ template class DynamicGraph // move all filled edges for (auto edge : GetAdjacentEdgeRange(node)) { - if (new_edge_index == std::numeric_limits::max()) - { - throw util::exception("There are too many edges, OSRM only supports 2^32" + - SOURCE_REF); - } edge_list[edge].target = old_to_new_node[edge_list[edge].target]; BOOST_ASSERT(edge_list[edge].target != SPECIAL_NODEID); old_to_new_edge[edge] = new_edge_index++;