@@ -136,12 +136,24 @@ int Contractor::Run()
136136
137137 TIMER_START (preparing);
138138
139+ util::Log () << " Reading node weights." ;
140+ std::vector<EdgeWeight> node_weights;
141+ std::string node_file_name = config.osrm_input_path .string () + " .enw" ;
142+
143+ {
144+ storage::io::FileReader node_file (node_file_name,
145+ storage::io::FileReader::VerifyFingerprint);
146+ node_file.DeserializeVector (node_weights);
147+ }
148+ util::Log () << " Done reading node weights." ;
149+
139150 util::Log () << " Loading edge-expanded graph representation" ;
140151
141152 util::DeallocatingVector<extractor::EdgeBasedEdge> edge_based_edge_list;
142153
143154 EdgeID max_edge_id = LoadEdgeExpandedGraph (config.edge_based_graph_path ,
144155 edge_based_edge_list,
156+ node_weights,
145157 config.edge_segment_lookup_path ,
146158 config.edge_penalty_path ,
147159 config.segment_speed_lookup_paths ,
@@ -163,17 +175,6 @@ int Contractor::Run()
163175 ReadNodeLevels (node_levels);
164176 }
165177
166- util::Log () << " Reading node weights." ;
167- std::vector<EdgeWeight> node_weights;
168- std::string node_file_name = config.osrm_input_path .string () + " .enw" ;
169-
170- {
171- storage::io::FileReader node_file (node_file_name,
172- storage::io::FileReader::VerifyFingerprint);
173- node_file.DeserializeVector (node_weights);
174- }
175- util::Log () << " Done reading node weights." ;
176-
177178 util::DeallocatingVector<QueryEdge> contracted_edge_list;
178179 ContractGraph (max_edge_id,
179180 edge_based_edge_list,
@@ -499,6 +500,7 @@ parse_turn_penalty_lookup_from_csv_files(const std::vector<std::string> &turn_pe
499500EdgeID Contractor::LoadEdgeExpandedGraph (
500501 std::string const &edge_based_graph_filename,
501502 util::DeallocatingVector<extractor::EdgeBasedEdge> &edge_based_edge_list,
503+ std::vector<EdgeWeight> &node_weights,
502504 const std::string &edge_segment_lookup_filename,
503505 const std::string &edge_penalty_filename,
504506 const std::vector<std::string> &segment_speed_filenames,
@@ -914,6 +916,11 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
914916 previous_osm_node_id = segmentblocks[i].this_osm_node_id ;
915917 }
916918
919+ // Update the node-weight cache. This is the weight of the edge-based-node only,
920+ // it doesn't include the turn. We may visit the same node multiple times, but
921+ // we should always assign the same value here.
922+ node_weights[inbuffer.source ] = new_weight;
923+
917924 // We found a zero-speed edge, so we'll skip this whole edge-based-edge which
918925 // effectively removes it from the routing network.
919926 if (skip_this_edge)
0 commit comments