Fix naming conventions of TrajanSCC

This commit is contained in:
Patrick Niklaus 2016-04-29 00:39:59 +02:00
parent e470d1ae1c
commit 83482afa02
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B
4 changed files with 19 additions and 19 deletions

View File

@ -57,7 +57,7 @@ template <typename GraphT> class TarjanSCC
BOOST_ASSERT(m_graph->GetNumberOfNodes() > 0);
}
void run()
void Run()
{
TIMER_START(SCC_RUN);
const NodeID max_node_id = m_graph->GetNumberOfNodes();
@ -167,16 +167,16 @@ template <typename GraphT> class TarjanSCC
});
}
std::size_t get_number_of_components() const { return component_size_vector.size(); }
std::size_t GetNumberOfComponents() const { return component_size_vector.size(); }
std::size_t get_size_one_count() const { return size_one_counter; }
std::size_t GetSizeOneCount() const { return size_one_counter; }
unsigned get_component_size(const unsigned component_id) const
unsigned GetComponentSize(const unsigned component_id) const
{
return component_size_vector[component_id];
}
unsigned get_component_id(const NodeID node) const { return components_index[node]; }
unsigned GetComponentID(const NodeID node) const { return components_index[node]; }
};
}
}

View File

@ -84,9 +84,9 @@ SCC_Component SplitUnaccessibleLocations(const std::size_t number_of_locations,
auto wrapper = std::make_shared<util::MatrixGraphWrapper<EdgeWeight>>(result_table.GetTable(),
number_of_locations);
auto scc = extractor::TarjanSCC<util::MatrixGraphWrapper<EdgeWeight>>(wrapper);
scc.run();
scc.Run();
const auto number_of_components = scc.get_number_of_components();
const auto number_of_components = scc.GetNumberOfComponents();
std::vector<std::size_t> range_insertion;
std::vector<std::size_t> range;
@ -100,15 +100,15 @@ SCC_Component SplitUnaccessibleLocations(const std::size_t number_of_locations,
{
range_insertion.push_back(prefix);
range.push_back(prefix);
prefix += scc.get_component_size(j);
prefix += scc.GetComponentSize(j);
}
// senitel
range.push_back(components.size());
for (std::size_t i = 0; i < number_of_locations; ++i)
{
components[range_insertion[scc.get_component_id(i)]] = i;
++range_insertion[scc.get_component_id(i)];
components[range_insertion[scc.GetComponentID(i)]] = i;
++range_insertion[scc.GetComponentID(i)];
}
return SCC_Component(std::move(components), std::move(range));

View File

@ -392,16 +392,16 @@ void Extractor::FindComponents(unsigned max_edge_id,
TarjanSCC<UncontractedGraph> component_search(
std::const_pointer_cast<const UncontractedGraph>(uncontractor_graph));
component_search.run();
component_search.Run();
for (auto &node : input_nodes)
{
auto forward_component = component_search.get_component_id(node.forward_segment_id.id);
auto forward_component = component_search.GetComponentID(node.forward_segment_id.id);
BOOST_ASSERT(!node.reverse_segment_id.enabled ||
forward_component ==
component_search.get_component_id(node.reverse_segment_id.id));
component_search.GetComponentID(node.reverse_segment_id.id));
const unsigned component_size = component_search.get_component_size(forward_component);
const unsigned component_size = component_search.GetComponentSize(forward_component);
node.component.is_tiny = component_size < config.small_component_size;
node.component.id = 1 + forward_component;
}

View File

@ -122,10 +122,10 @@ int main(int argc, char *argv[]) try
auto tarjan =
osrm::util::make_unique<osrm::extractor::TarjanSCC<osrm::tools::TarjanGraph>>(graph);
tarjan->run();
osrm::util::SimpleLogger().Write() << "identified: " << tarjan->get_number_of_components()
tarjan->Run();
osrm::util::SimpleLogger().Write() << "identified: " << tarjan->GetNumberOfComponents()
<< " many components";
osrm::util::SimpleLogger().Write() << "identified " << tarjan->get_size_one_count()
osrm::util::SimpleLogger().Write() << "identified " << tarjan->GetSizeOneCount()
<< " size 1 SCCs";
// output
@ -187,8 +187,8 @@ int main(int argc, char *argv[]) try
BOOST_ASSERT(target != SPECIAL_NODEID);
const unsigned size_of_containing_component =
std::min(tarjan->get_component_size(tarjan->get_component_id(source)),
tarjan->get_component_size(tarjan->get_component_id(target)));
std::min(tarjan->GetComponentSize(tarjan->GetComponentID(source)),
tarjan->GetComponentSize(tarjan->GetComponentID(target)));
// edges that end on bollard nodes may actually be in two distinct components
if (size_of_containing_component < 1000)