Renumbers all _forward_ edges and sets the edge_id. A specific numbering is not important. Any unique ID will do. Returns the number of edge-based nodes.
| 260 | /// A specific numbering is not important. Any unique ID will do. |
| 261 | /// Returns the number of edge-based nodes. |
| 262 | unsigned EdgeBasedGraphFactory::LabelEdgeBasedNodes() |
| 263 | { |
| 264 | // heuristic: node-based graph node is a simple intersection with four edges |
| 265 | // (edge-based nodes) |
| 266 | constexpr std::size_t ESTIMATED_EDGE_COUNT = 4; |
| 267 | m_edge_based_node_weights.reserve(ESTIMATED_EDGE_COUNT * m_node_based_graph.GetNumberOfNodes()); |
| 268 | m_edge_based_node_durations.reserve(ESTIMATED_EDGE_COUNT * |
| 269 | m_node_based_graph.GetNumberOfNodes()); |
| 270 | m_edge_based_node_distances.reserve(ESTIMATED_EDGE_COUNT * |
| 271 | m_node_based_graph.GetNumberOfNodes()); |
| 272 | nbe_to_ebn_mapping.resize(m_node_based_graph.GetEdgeCapacity(), SPECIAL_NODEID); |
| 273 | |
| 274 | // renumber edge based node of outgoing edges |
| 275 | unsigned numbered_edges_count = 0; |
| 276 | for (const auto current_node : util::irange(0u, m_node_based_graph.GetNumberOfNodes())) |
| 277 | { |
| 278 | for (const auto current_edge : m_node_based_graph.GetAdjacentEdgeRange(current_node)) |
| 279 | { |
| 280 | const EdgeData &edge_data = m_node_based_graph.GetEdgeData(current_edge); |
| 281 | // only number incoming edges |
| 282 | if (edge_data.reversed) |
| 283 | { |
| 284 | continue; |
| 285 | } |
| 286 | |
| 287 | m_edge_based_node_weights.push_back(edge_data.weight); |
| 288 | m_edge_based_node_durations.push_back(edge_data.duration); |
| 289 | m_edge_based_node_distances.push_back(edge_data.distance); |
| 290 | |
| 291 | BOOST_ASSERT(numbered_edges_count < m_node_based_graph.GetNumberOfEdges()); |
| 292 | nbe_to_ebn_mapping[current_edge] = numbered_edges_count; |
| 293 | ++numbered_edges_count; |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | return numbered_edges_count; |
| 298 | } |
| 299 | |
| 300 | // Creates the nodes in the edge expanded graph from edges in the node-based graph. |
| 301 | std::vector<NBGToEBG> |
nothing calls this directly
no test coverage detected