@@ -100,10 +100,9 @@ struct ContractorNodeData
100100 ContractorNodeData (std::size_t number_of_nodes,
101101 std::vector<bool > uncontracted_nodes_,
102102 std::vector<bool > contractible_,
103- std::vector<bool > one_way_streets )
103+ const std::vector<bool > &one_way_streets_ )
104104 : is_core(std::move(uncontracted_nodes_)), is_contractible(std::move(contractible_)),
105- one_way_streets (std::move(one_way_streets)), priorities(number_of_nodes),
106- depths(number_of_nodes, 0 )
105+ one_way_streets{one_way_streets_}, priorities(number_of_nodes), depths(number_of_nodes, 0 )
107106 {
108107 if (is_contractible.empty ())
109108 {
@@ -113,6 +112,10 @@ struct ContractorNodeData
113112 {
114113 is_core.resize (number_of_nodes, true );
115114 }
115+ if (one_way_streets.size () < number_of_nodes)
116+ {
117+ one_way_streets.resize (number_of_nodes, false );
118+ }
116119 }
117120
118121 /* * All these are keyed by NodeID */
@@ -550,7 +553,7 @@ bool IsNodeIndependent(const ContractorGraph &graph,
550553std::vector<bool > contractGraph (ContractorGraph &graph,
551554 std::vector<bool > node_is_uncontracted_,
552555 std::vector<bool > node_is_contractible_,
553- std::vector<bool > one_way_streets,
556+ const std::vector<bool > & one_way_streets,
554557 double core_factor)
555558{
556559 /* * A heap kept in thread-local storage to avoid multiple recreations of it. */
@@ -563,12 +566,10 @@ std::vector<bool> contractGraph(ContractorGraph &graph,
563566
564567 const unsigned int number_of_nodes = graph.GetNumberOfNodes ();
565568
566- BOOST_ASSERT (one_way_streets.size () >= number_of_nodes);
567-
568569 ContractorNodeData node_data{number_of_nodes,
569570 std::move (node_is_uncontracted_),
570571 std::move (node_is_contractible_),
571- std::move ( one_way_streets) };
572+ one_way_streets};
572573
573574 TIMER_DECLARE (init_priorities);
574575 TIMER_DECLARE (contract);
@@ -715,10 +716,10 @@ std::vector<bool> contractGraph(ContractorGraph &graph,
715716using GraphAndFilter = std::tuple<QueryGraph, std::vector<std::vector<bool >>>;
716717
717718GraphAndFilter contractFullGraph (ContractorGraph contractor_graph,
718- std::vector<bool > one_way_streets)
719+ const std::vector<bool > & one_way_streets)
719720{
720721 auto num_nodes = contractor_graph.GetNumberOfNodes ();
721- contractGraph (contractor_graph, std::move ( one_way_streets) );
722+ contractGraph (contractor_graph, one_way_streets);
722723
723724 auto edges = toEdges<QueryEdge>(std::move (contractor_graph));
724725 std::vector<bool > edge_filter (edges.size (), true );
@@ -727,14 +728,14 @@ GraphAndFilter contractFullGraph(ContractorGraph contractor_graph,
727728}
728729
729730GraphAndFilter contractExcludableGraph (ContractorGraph contractor_graph_,
730- std::vector<bool > one_way_streets,
731+ const std::vector<bool > & one_way_streets,
731732 const std::vector<std::vector<bool >> &filters)
732733{
733734 if (filters.size () == 1 )
734735 {
735736 if (std::all_of (filters.front ().begin (), filters.front ().end (), [](auto v) { return v; }))
736737 {
737- return contractFullGraph (std::move (contractor_graph_), std::move ( one_way_streets) );
738+ return contractFullGraph (std::move (contractor_graph_), one_way_streets);
738739 }
739740 }
740741
0 commit comments