Move reserve call before pushing weights

This commit is contained in:
Michael Krasnyk 2017-05-03 09:34:57 +02:00 committed by Patrick Niklaus
parent 2a24468267
commit 1f701341db

View File

@ -180,7 +180,6 @@ void EdgeBasedGraphFactory::Run(ScriptingEnvironment &scripting_environment,
TIMER_STOP(renumber); TIMER_STOP(renumber);
TIMER_START(generate_nodes); TIMER_START(generate_nodes);
m_edge_based_node_weights.reserve(m_max_edge_id + 1);
{ {
auto mapping = GenerateEdgeExpandedNodes(); auto mapping = GenerateEdgeExpandedNodes();
files::writeNBGMapping(cnbg_ebg_mapping_path, mapping); files::writeNBGMapping(cnbg_ebg_mapping_path, mapping);
@ -208,6 +207,9 @@ void EdgeBasedGraphFactory::Run(ScriptingEnvironment &scripting_environment,
/// Returns the number of edge based nodes. /// Returns the number of edge based nodes.
unsigned EdgeBasedGraphFactory::RenumberEdges() unsigned EdgeBasedGraphFactory::RenumberEdges()
{ {
// heuristic: node-based graph node is a simple intersection with four edges (edge-based nodes)
m_edge_based_node_weights.reserve(4 * m_node_based_graph->GetNumberOfNodes());
// renumber edge based node of outgoing edges // renumber edge based node of outgoing edges
unsigned numbered_edges_count = 0; unsigned numbered_edges_count = 0;
for (const auto current_node : util::irange(0u, m_node_based_graph->GetNumberOfNodes())) for (const auto current_node : util::irange(0u, m_node_based_graph->GetNumberOfNodes()))