Skip to content

Commit

Permalink
Merge pull request #1481 from Project-OSRM/fix/no-big-cc-pruning
Browse files Browse the repository at this point in the history
Only activate pruning for big cc after one was found
  • Loading branch information
TheMarex committed May 18, 2015
2 parents 6d9c3bc + fd9bb3a commit 8b81887
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions data_structures/static_rtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ class StaticRTree
unsigned inspected_elements = 0;
unsigned number_of_elements_from_big_cc = 0;
unsigned number_of_elements_from_tiny_cc = 0;
// is true if a big cc was added to the queue to we also have a lower bound
// for them. it actives pruning for big components
bool has_big_cc = false;

#ifdef NDEBUG
unsigned pruned_elements = 0;
Expand Down Expand Up @@ -697,10 +700,11 @@ class StaticRTree
BOOST_ASSERT(0.f <= current_perpendicular_distance);

if (pruning_bound.get() >= current_perpendicular_distance ||
current_edge.is_in_tiny_cc())
(!has_big_cc && !current_edge.is_in_tiny_cc()))
{
pruning_bound.insert(current_perpendicular_distance);
traversal_queue.emplace(current_perpendicular_distance, current_edge);
has_big_cc = has_big_cc || !current_edge.is_in_tiny_cc();
}
#ifdef NDEBUG
else
Expand Down Expand Up @@ -812,6 +816,10 @@ class StaticRTree
unsigned number_of_elements_from_big_cc = 0;
unsigned number_of_elements_from_tiny_cc = 0;

// is true if a big cc was added to the queue to we also have a lower bound
// for them. it actives pruning for big components
bool has_big_cc = false;

unsigned pruned_elements = 0;

std::pair<double, double> projected_coordinate = {
Expand Down Expand Up @@ -852,10 +860,11 @@ class StaticRTree
BOOST_ASSERT(0.f <= current_perpendicular_distance);

if (pruning_bound.get() >= current_perpendicular_distance ||
current_edge.is_in_tiny_cc())
(!has_big_cc && !current_edge.is_in_tiny_cc()))
{
pruning_bound.insert(current_perpendicular_distance);
traversal_queue.emplace(current_perpendicular_distance, current_edge);
has_big_cc = has_big_cc || !current_edge.is_in_tiny_cc();
}
else
{
Expand Down

0 comments on commit 8b81887

Please sign in to comment.