From 79ef204e1f8feb8ad89faabc12585ab7d3f2b5b7 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Wed, 15 Mar 2017 14:36:41 +0100 Subject: [PATCH] Change edge_id to from_clique_arc in MultiLayerDijkstraHeapData --- .../datafacade/algorithm_datafacade.hpp | 3 ++ .../contiguous_internalmem_datafacade.hpp | 6 ++++ .../routing_algorithms/routing_base_mld.hpp | 33 ++++++++----------- include/engine/search_engine_data.hpp | 6 ++-- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/include/engine/datafacade/algorithm_datafacade.hpp b/include/engine/datafacade/algorithm_datafacade.hpp index 5608e925152..7a78779b4b7 100644 --- a/include/engine/datafacade/algorithm_datafacade.hpp +++ b/include/engine/datafacade/algorithm_datafacade.hpp @@ -89,6 +89,9 @@ template <> class AlgorithmDataFacade virtual const partition::MultiLevelPartitionView &GetMultiLevelPartition() const = 0; virtual const partition::CellStorageView &GetCellStorage() const = 0; + + // searches for a specific edge + virtual EdgeID FindEdge(const NodeID from, const NodeID to) const = 0; }; } } diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index dac9906ccb9..8185af8e87a 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -1067,6 +1067,12 @@ class ContiguousInternalMemoryDataFacade { return m_query_graph->GetAdjacentEdgeRange(node); } + + // searches for a specific edge + EdgeID FindEdge(const NodeID from, const NodeID to) const override final + { + return m_query_graph->FindEdge(from, to); + } }; } } diff --git a/include/engine/routing_algorithms/routing_base_mld.hpp b/include/engine/routing_algorithms/routing_base_mld.hpp index 7dad4f20165..8e38d502307 100644 --- a/include/engine/routing_algorithms/routing_base_mld.hpp +++ b/include/engine/routing_algorithms/routing_base_mld.hpp @@ -87,13 +87,8 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade= 1) && // only if at least the first level and - (node_data.parent == node || // is the first point of the path - node_data.edge_id != SPECIAL_EDGEID); // or an overlay entreƩ point - if (check_overlay_edges) + if (level >= 1 && !forward_heap.GetData(node).from_clique_arc) { if (DIRECTION == FORWARD_DIRECTION) { @@ -109,11 +104,11 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade &fac } // Get packed path as edges {from node ID, to node ID, edge ID} - std::vector> packed_path; + std::vector> packed_path; NodeID current_node = middle, parent_node = forward_heap.GetData(middle).parent; while (parent_node != current_node) { const auto &data = forward_heap.GetData(current_node); - packed_path.push_back(std::make_tuple(parent_node, current_node, data.edge_id)); + packed_path.push_back(std::make_tuple(parent_node, current_node, data.from_clique_arc)); current_node = parent_node; parent_node = forward_heap.GetData(parent_node).parent; } @@ -236,7 +231,7 @@ search(const datafacade::ContiguousInternalMemoryDataFacade &fac while (parent_node != current_node) { const auto &data = reverse_heap.GetData(current_node); - packed_path.push_back(std::make_tuple(current_node, parent_node, data.edge_id)); + packed_path.push_back(std::make_tuple(current_node, parent_node, data.from_clique_arc)); current_node = parent_node; parent_node = reverse_heap.GetData(parent_node).parent; } @@ -248,11 +243,11 @@ search(const datafacade::ContiguousInternalMemoryDataFacade &fac for (auto const &packed_edge : packed_path) { NodeID source, target; - EdgeID edge_id; - std::tie(source, target, edge_id) = packed_edge; - if (edge_id != SPECIAL_EDGEID) + bool overlay_edge; + std::tie(source, target, overlay_edge) = packed_edge; + if (!overlay_edge) { // a base graph edge - unpacked_path.push_back(edge_id); + unpacked_path.push_back(facade.FindEdge(source, target)); } else { // an overlay graph edge diff --git a/include/engine/search_engine_data.hpp b/include/engine/search_engine_data.hpp index f84b921919b..57edf242764 100644 --- a/include/engine/search_engine_data.hpp +++ b/include/engine/search_engine_data.hpp @@ -26,9 +26,9 @@ struct ManyToManyHeapData : HeapData struct MultiLayerDijkstraHeapData : HeapData { - EdgeID edge_id; // edge id if parent -> node is a boundary edge - MultiLayerDijkstraHeapData(NodeID p) : HeapData(p), edge_id(SPECIAL_EDGEID) {} - MultiLayerDijkstraHeapData(NodeID p, EdgeID edge_id) : HeapData(p), edge_id(edge_id) {} + bool from_clique_arc; + MultiLayerDijkstraHeapData(NodeID p) : HeapData(p), from_clique_arc(false) {} + MultiLayerDijkstraHeapData(NodeID p, bool from) : HeapData(p), from_clique_arc(from) {} }; struct SearchEngineData