Fix naming conventions of TrajanSCC
This commit is contained in:
parent
e470d1ae1c
commit
83482afa02
@ -57,7 +57,7 @@ template <typename GraphT> class TarjanSCC
|
|||||||
BOOST_ASSERT(m_graph->GetNumberOfNodes() > 0);
|
BOOST_ASSERT(m_graph->GetNumberOfNodes() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void run()
|
void Run()
|
||||||
{
|
{
|
||||||
TIMER_START(SCC_RUN);
|
TIMER_START(SCC_RUN);
|
||||||
const NodeID max_node_id = m_graph->GetNumberOfNodes();
|
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];
|
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]; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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(),
|
auto wrapper = std::make_shared<util::MatrixGraphWrapper<EdgeWeight>>(result_table.GetTable(),
|
||||||
number_of_locations);
|
number_of_locations);
|
||||||
auto scc = extractor::TarjanSCC<util::MatrixGraphWrapper<EdgeWeight>>(wrapper);
|
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_insertion;
|
||||||
std::vector<std::size_t> range;
|
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_insertion.push_back(prefix);
|
||||||
range.push_back(prefix);
|
range.push_back(prefix);
|
||||||
prefix += scc.get_component_size(j);
|
prefix += scc.GetComponentSize(j);
|
||||||
}
|
}
|
||||||
// senitel
|
// senitel
|
||||||
range.push_back(components.size());
|
range.push_back(components.size());
|
||||||
|
|
||||||
for (std::size_t i = 0; i < number_of_locations; ++i)
|
for (std::size_t i = 0; i < number_of_locations; ++i)
|
||||||
{
|
{
|
||||||
components[range_insertion[scc.get_component_id(i)]] = i;
|
components[range_insertion[scc.GetComponentID(i)]] = i;
|
||||||
++range_insertion[scc.get_component_id(i)];
|
++range_insertion[scc.GetComponentID(i)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return SCC_Component(std::move(components), std::move(range));
|
return SCC_Component(std::move(components), std::move(range));
|
||||||
|
@ -392,16 +392,16 @@ void Extractor::FindComponents(unsigned max_edge_id,
|
|||||||
|
|
||||||
TarjanSCC<UncontractedGraph> component_search(
|
TarjanSCC<UncontractedGraph> component_search(
|
||||||
std::const_pointer_cast<const UncontractedGraph>(uncontractor_graph));
|
std::const_pointer_cast<const UncontractedGraph>(uncontractor_graph));
|
||||||
component_search.run();
|
component_search.Run();
|
||||||
|
|
||||||
for (auto &node : input_nodes)
|
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 ||
|
BOOST_ASSERT(!node.reverse_segment_id.enabled ||
|
||||||
forward_component ==
|
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.is_tiny = component_size < config.small_component_size;
|
||||||
node.component.id = 1 + forward_component;
|
node.component.id = 1 + forward_component;
|
||||||
}
|
}
|
||||||
|
@ -122,10 +122,10 @@ int main(int argc, char *argv[]) try
|
|||||||
|
|
||||||
auto tarjan =
|
auto tarjan =
|
||||||
osrm::util::make_unique<osrm::extractor::TarjanSCC<osrm::tools::TarjanGraph>>(graph);
|
osrm::util::make_unique<osrm::extractor::TarjanSCC<osrm::tools::TarjanGraph>>(graph);
|
||||||
tarjan->run();
|
tarjan->Run();
|
||||||
osrm::util::SimpleLogger().Write() << "identified: " << tarjan->get_number_of_components()
|
osrm::util::SimpleLogger().Write() << "identified: " << tarjan->GetNumberOfComponents()
|
||||||
<< " many components";
|
<< " many components";
|
||||||
osrm::util::SimpleLogger().Write() << "identified " << tarjan->get_size_one_count()
|
osrm::util::SimpleLogger().Write() << "identified " << tarjan->GetSizeOneCount()
|
||||||
<< " size 1 SCCs";
|
<< " size 1 SCCs";
|
||||||
|
|
||||||
// output
|
// output
|
||||||
@ -187,8 +187,8 @@ int main(int argc, char *argv[]) try
|
|||||||
BOOST_ASSERT(target != SPECIAL_NODEID);
|
BOOST_ASSERT(target != SPECIAL_NODEID);
|
||||||
|
|
||||||
const unsigned size_of_containing_component =
|
const unsigned size_of_containing_component =
|
||||||
std::min(tarjan->get_component_size(tarjan->get_component_id(source)),
|
std::min(tarjan->GetComponentSize(tarjan->GetComponentID(source)),
|
||||||
tarjan->get_component_size(tarjan->get_component_id(target)));
|
tarjan->GetComponentSize(tarjan->GetComponentID(target)));
|
||||||
|
|
||||||
// edges that end on bollard nodes may actually be in two distinct components
|
// edges that end on bollard nodes may actually be in two distinct components
|
||||||
if (size_of_containing_component < 1000)
|
if (size_of_containing_component < 1000)
|
||||||
|
Loading…
Reference in New Issue
Block a user