Don't use phantom node pairs as input for distance table
This commit is contained in:
@@ -67,7 +67,7 @@ class ManyToManyRouting final
|
||||
~ManyToManyRouting() {}
|
||||
|
||||
std::shared_ptr<std::vector<EdgeWeight>>
|
||||
operator()(const std::vector<PhantomNodePair> &phantom_sources_array, const std::vector<PhantomNodePair> &phantom_targets_array) const
|
||||
operator()(const std::vector<PhantomNode> &phantom_sources_array, const std::vector<PhantomNode> &phantom_targets_array) const
|
||||
{
|
||||
const auto number_of_sources = phantom_sources_array.size();
|
||||
const auto number_of_targets = phantom_targets_array.size();
|
||||
@@ -83,35 +83,22 @@ class ManyToManyRouting final
|
||||
SearchSpaceWithBuckets search_space_with_buckets;
|
||||
|
||||
unsigned target_id = 0;
|
||||
for (const auto &pair : phantom_targets_array)
|
||||
for (const auto &phantom : phantom_targets_array)
|
||||
{
|
||||
query_heap.Clear();
|
||||
// insert target(s) at distance 0
|
||||
|
||||
if (SPECIAL_NODEID != pair.first.forward_node_id)
|
||||
if (SPECIAL_NODEID != phantom.forward_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.first.forward_node_id,
|
||||
pair.first.GetForwardWeightPlusOffset(),
|
||||
pair.first.forward_node_id);
|
||||
query_heap.Insert(phantom.forward_node_id,
|
||||
phantom.GetForwardWeightPlusOffset(),
|
||||
phantom.forward_node_id);
|
||||
}
|
||||
if (SPECIAL_NODEID != pair.first.reverse_node_id)
|
||||
if (SPECIAL_NODEID != phantom.reverse_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.first.reverse_node_id,
|
||||
pair.first.GetReverseWeightPlusOffset(),
|
||||
pair.first.reverse_node_id);
|
||||
}
|
||||
|
||||
if (SPECIAL_NODEID != pair.second.forward_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.second.forward_node_id,
|
||||
pair.second.GetForwardWeightPlusOffset(),
|
||||
pair.second.forward_node_id);
|
||||
}
|
||||
if (SPECIAL_NODEID != pair.second.reverse_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.second.reverse_node_id,
|
||||
pair.second.GetReverseWeightPlusOffset(),
|
||||
pair.second.reverse_node_id);
|
||||
query_heap.Insert(phantom.reverse_node_id,
|
||||
phantom.GetReverseWeightPlusOffset(),
|
||||
phantom.reverse_node_id);
|
||||
}
|
||||
|
||||
// explore search space
|
||||
@@ -124,35 +111,22 @@ class ManyToManyRouting final
|
||||
|
||||
// for each source do forward search
|
||||
unsigned source_id = 0;
|
||||
for (const auto &pair : phantom_sources_array)
|
||||
for (const auto &phantom : phantom_sources_array)
|
||||
{
|
||||
query_heap.Clear();
|
||||
// insert target(s) at distance 0
|
||||
|
||||
if (SPECIAL_NODEID != pair.first.forward_node_id)
|
||||
if (SPECIAL_NODEID != phantom.forward_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.first.forward_node_id,
|
||||
-pair.first.GetForwardWeightPlusOffset(),
|
||||
pair.first.forward_node_id);
|
||||
query_heap.Insert(phantom.forward_node_id,
|
||||
-phantom.GetForwardWeightPlusOffset(),
|
||||
phantom.forward_node_id);
|
||||
}
|
||||
if (SPECIAL_NODEID != pair.first.reverse_node_id)
|
||||
if (SPECIAL_NODEID != phantom.reverse_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.first.reverse_node_id,
|
||||
-pair.first.GetReverseWeightPlusOffset(),
|
||||
pair.first.reverse_node_id);
|
||||
}
|
||||
|
||||
if (SPECIAL_NODEID != pair.second.forward_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.second.forward_node_id,
|
||||
-pair.second.GetForwardWeightPlusOffset(),
|
||||
pair.second.forward_node_id);
|
||||
}
|
||||
if (SPECIAL_NODEID != pair.second.reverse_node_id)
|
||||
{
|
||||
query_heap.Insert(pair.second.reverse_node_id,
|
||||
-pair.second.GetReverseWeightPlusOffset(),
|
||||
pair.second.reverse_node_id);
|
||||
query_heap.Insert(phantom.reverse_node_id,
|
||||
-phantom.GetReverseWeightPlusOffset(),
|
||||
phantom.reverse_node_id);
|
||||
}
|
||||
|
||||
// explore search space
|
||||
|
||||
Reference in New Issue
Block a user