Remove reference to restrictions and bollard nodes because it does not work
This commit is contained in:
parent
43b881d0cd
commit
3c055642d5
@ -33,9 +33,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../data_structures/import_edge.hpp"
|
||||
#include "../data_structures/query_node.hpp"
|
||||
#include "../data_structures/percent.hpp"
|
||||
#include "../data_structures/restriction.hpp"
|
||||
#include "../data_structures/restriction_map.hpp"
|
||||
#include "../data_structures/turn_instructions.hpp"
|
||||
|
||||
#include "../util/integer_range.hpp"
|
||||
#include "../util/simple_logger.hpp"
|
||||
@ -75,27 +72,21 @@ template <typename GraphT> class TarjanSCC
|
||||
|
||||
std::vector<unsigned> components_index;
|
||||
std::vector<NodeID> component_size_vector;
|
||||
std::shared_ptr<GraphT> m_node_based_graph;
|
||||
std::unordered_set<NodeID> barrier_node_set;
|
||||
RestrictionMap m_restriction_map;
|
||||
std::shared_ptr<GraphT> m_graph;
|
||||
std::size_t size_one_counter;
|
||||
|
||||
public:
|
||||
template <class ContainerT>
|
||||
TarjanSCC(std::shared_ptr<GraphT> graph,
|
||||
const RestrictionMap &restrictions,
|
||||
const ContainerT &barrier_node_list)
|
||||
: components_index(graph->GetNumberOfNodes(), SPECIAL_NODEID), m_node_based_graph(graph),
|
||||
m_restriction_map(restrictions), size_one_counter(0)
|
||||
TarjanSCC(std::shared_ptr<GraphT> graph)
|
||||
: components_index(graph->GetNumberOfNodes(), SPECIAL_NODEID), m_graph(graph),
|
||||
size_one_counter(0)
|
||||
{
|
||||
barrier_node_set.insert(std::begin(barrier_node_list), std::end(barrier_node_list));
|
||||
BOOST_ASSERT(m_node_based_graph->GetNumberOfNodes() > 0);
|
||||
BOOST_ASSERT(m_graph->GetNumberOfNodes() > 0);
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
TIMER_START(SCC_RUN);
|
||||
const NodeID max_node_id = m_node_based_graph->GetNumberOfNodes();
|
||||
const NodeID max_node_id = m_graph->GetNumberOfNodes();
|
||||
|
||||
// The following is a hack to distinguish between stuff that happens
|
||||
// before the recursive call and stuff that happens after
|
||||
@ -140,30 +131,9 @@ template <typename GraphT> class TarjanSCC
|
||||
tarjan_node_list[v].on_stack = true;
|
||||
++index;
|
||||
|
||||
const NodeID to_node_of_only_restriction =
|
||||
m_restriction_map.CheckForEmanatingIsOnlyTurn(u, v);
|
||||
|
||||
for (const auto current_edge : m_node_based_graph->GetAdjacentEdgeRange(v))
|
||||
for (const auto current_edge : m_graph->GetAdjacentEdgeRange(v))
|
||||
{
|
||||
const auto vprime = m_node_based_graph->GetTarget(current_edge);
|
||||
|
||||
// Traverse outgoing edges
|
||||
if (barrier_node_set.find(v) != barrier_node_set.end() && u != vprime)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (to_node_of_only_restriction != std::numeric_limits<unsigned>::max() &&
|
||||
vprime == to_node_of_only_restriction)
|
||||
{
|
||||
// At an only_-restriction but not at the right turn
|
||||
// continue;
|
||||
}
|
||||
|
||||
if (m_restriction_map.CheckIfTurnIsRestricted(u, v, vprime))
|
||||
{
|
||||
// continue;
|
||||
}
|
||||
const auto vprime = m_graph->GetTarget(current_edge);
|
||||
|
||||
if (SPECIAL_NODEID == tarjan_node_list[vprime].index)
|
||||
{
|
||||
@ -182,9 +152,7 @@ template <typename GraphT> class TarjanSCC
|
||||
else
|
||||
{
|
||||
processing_node_before_recursion[v] = true;
|
||||
tarjan_node_list[currentFrame.parent].low_link =
|
||||
std::min(tarjan_node_list[currentFrame.parent].low_link,
|
||||
tarjan_node_list[v].low_link);
|
||||
tarjan_node_list[u].low_link = std::min(tarjan_node_list[u].low_link, tarjan_node_list[v].low_link);
|
||||
// after recursion, lets do cycle checking
|
||||
// Check if we found a cycle. This is the bottom part of the recursion
|
||||
if (tarjan_node_list[v].low_link == tarjan_node_list[v].index)
|
||||
|
@ -282,8 +282,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes()
|
||||
SimpleLogger().Write() << "Identifying components of the (compressed) road network";
|
||||
|
||||
// Run a BFS on the undirected graph and identify small components
|
||||
TarjanSCC<NodeBasedDynamicGraph> component_explorer(m_node_based_graph, *m_restriction_map,
|
||||
m_barrier_nodes);
|
||||
TarjanSCC<NodeBasedDynamicGraph> component_explorer(m_node_based_graph);
|
||||
|
||||
component_explorer.run();
|
||||
|
||||
|
@ -76,19 +76,8 @@ void DeleteFileIfExists(const std::string &file_name)
|
||||
}
|
||||
}
|
||||
|
||||
void LoadRestrictions(const char* path, std::vector<TurnRestriction>& restriction_list)
|
||||
{
|
||||
std::ifstream input_stream(path, std::ios::binary);
|
||||
if (!input_stream.is_open())
|
||||
{
|
||||
throw osrm::exception("Cannot open restriction file");
|
||||
}
|
||||
loadRestrictionsFromFile(input_stream, restriction_list);
|
||||
}
|
||||
|
||||
std::size_t LoadGraph(const char* path,
|
||||
std::vector<QueryNode>& coordinate_list,
|
||||
std::vector<NodeID>& barrier_node_list,
|
||||
std::vector<TarjanEdge>& graph_edge_list)
|
||||
{
|
||||
std::ifstream input_stream(path, std::ifstream::in | std::ifstream::binary);
|
||||
@ -100,6 +89,7 @@ std::size_t LoadGraph(const char* path,
|
||||
// load graph data
|
||||
std::vector<NodeBasedEdge> edge_list;
|
||||
std::vector<NodeID> traffic_light_node_list;
|
||||
std::vector<NodeID> barrier_node_list;
|
||||
|
||||
auto number_of_nodes = loadNodesFromFile(input_stream, barrier_node_list,
|
||||
traffic_light_node_list,
|
||||
@ -136,8 +126,6 @@ std::size_t LoadGraph(const char* path,
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::vector<QueryNode> coordinate_list;
|
||||
std::vector<TurnRestriction> restriction_list;
|
||||
std::vector<NodeID> barrier_node_list;
|
||||
|
||||
LogPolicy::GetInstance().Unmute();
|
||||
try
|
||||
@ -146,15 +134,14 @@ int main(int argc, char *argv[])
|
||||
if (argc < 3)
|
||||
{
|
||||
SimpleLogger().Write(logWARNING) << "usage:\n" << argv[0]
|
||||
<< " <osrm> <osrm.restrictions>";
|
||||
<< " <osrm>";
|
||||
return -1;
|
||||
}
|
||||
|
||||
SimpleLogger().Write() << "Using restrictions from file: " << argv[2];
|
||||
|
||||
std::vector<TarjanEdge> graph_edge_list;
|
||||
auto number_of_nodes = LoadGraph(argv[1], coordinate_list, barrier_node_list, graph_edge_list);
|
||||
LoadRestrictions(argv[2], restriction_list);
|
||||
auto number_of_nodes = LoadGraph(argv[1], coordinate_list, graph_edge_list);
|
||||
|
||||
tbb::parallel_sort(graph_edge_list.begin(), graph_edge_list.end());
|
||||
const auto graph = std::make_shared<TarjanGraph>(number_of_nodes, graph_edge_list);
|
||||
@ -163,9 +150,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
SimpleLogger().Write() << "Starting SCC graph traversal";
|
||||
|
||||
RestrictionMap restriction_map(restriction_list);
|
||||
auto tarjan = osrm::make_unique<TarjanSCC<TarjanGraph>>(graph, restriction_map,
|
||||
barrier_node_list);
|
||||
auto tarjan = osrm::make_unique<TarjanSCC<TarjanGraph>>(graph);
|
||||
tarjan->run();
|
||||
SimpleLogger().Write() << "identified: " << tarjan->get_number_of_components()
|
||||
<< " many components";
|
||||
|
Loading…
Reference in New Issue
Block a user