diff --git a/include/engine/routing_algorithms/routing_base.hpp b/include/engine/routing_algorithms/routing_base.hpp index 9afee1c44..4b22237b8 100644 --- a/include/engine/routing_algorithms/routing_base.hpp +++ b/include/engine/routing_algorithms/routing_base.hpp @@ -31,33 +31,35 @@ template class BasicRoutingInterface explicit BasicRoutingInterface(DataFacadeT *facade) : facade(facade) {} ~BasicRoutingInterface() {} - // min_edge_offset is needed in case we use multiple - // nodes as start/target nodes with different (even negative) offsets. - // In that case the termination criterion is not correct - // anymore. - // - // Example: - // forward heap: a(-100), b(0), - // reverse heap: c(0), d(100) - // - // a --- d - // \ / - // / \ - // b --- c - // - // This is equivalent to running a bi-directional Dijkstra on the following graph: - // - // a --- d - // / \ / \ - // y x z - // \ / \ / - // b --- c - // - // The graph is constructed by inserting nodes y and z that are connected to the initial nodes - // using edges (y, a) with weight -100, (y, b) with weight 0 and, - // (d, z) with weight 100, (c, z) with weight 0 corresponding. - // Since we are dealing with a graph that contains _negative_ edges, - // we need to add an offset to the termination criterion. + /* + min_edge_offset is needed in case we use multiple + nodes as start/target nodes with different (even negative) offsets. + In that case the termination criterion is not correct + anymore. + + Example: + forward heap: a(-100), b(0), + reverse heap: c(0), d(100) + + a --- d + \ / + / \ + b --- c + + This is equivalent to running a bi-directional Dijkstra on the following graph: + + a --- d + / \ / \ + y x z + \ / \ / + b --- c + + The graph is constructed by inserting nodes y and z that are connected to the initial nodes + using edges (y, a) with weight -100, (y, b) with weight 0 and, + (d, z) with weight 100, (c, z) with weight 0 corresponding. + Since we are dealing with a graph that contains _negative_ edges, + we need to add an offset to the termination criterion. + */ void RoutingStep(SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &reverse_heap, NodeID &middle_node_id, @@ -293,9 +295,12 @@ template class BasicRoutingInterface { BOOST_ASSERT(i < id_vector.size()); BOOST_ASSERT(phantom_node_pair.target_phantom.forward_travel_mode > 0); - unpacked_path.emplace_back(PathData{ - id_vector[i], phantom_node_pair.target_phantom.name_id, TurnInstruction::NoTurn, - 0, phantom_node_pair.target_phantom.forward_travel_mode}); + unpacked_path.emplace_back( + PathData{id_vector[i], + phantom_node_pair.target_phantom.name_id, + TurnInstruction::NoTurn, + 0, + phantom_node_pair.target_phantom.forward_travel_mode}); } } @@ -493,8 +498,8 @@ template class BasicRoutingInterface // TODO check if unordered_set might be faster // sort by id and increasing by distance - auto entry_point_comparator = [](const std::pair &lhs, - const std::pair &rhs) + auto entry_point_comparator = + [](const std::pair &lhs, const std::pair &rhs) { return lhs.first < rhs.first || (lhs.first == rhs.first && lhs.second < rhs.second); };