| 85 | } |
| 86 | |
| 87 | void NodeBasedGraphFactory::CompressGeometry() |
| 88 | { |
| 89 | for (const auto nbg_node_u : util::irange(0u, compressed_output_graph.GetNumberOfNodes())) |
| 90 | { |
| 91 | for (EdgeID nbg_edge_id : compressed_output_graph.GetAdjacentEdgeRange(nbg_node_u)) |
| 92 | { |
| 93 | BOOST_ASSERT(nbg_edge_id != SPECIAL_EDGEID); |
| 94 | |
| 95 | const auto &nbg_edge_data = compressed_output_graph.GetEdgeData(nbg_edge_id); |
| 96 | const auto nbg_node_v = compressed_output_graph.GetTarget(nbg_edge_id); |
| 97 | BOOST_ASSERT(nbg_node_v != SPECIAL_NODEID); |
| 98 | BOOST_ASSERT(nbg_node_u != nbg_node_v); |
| 99 | |
| 100 | // pick only every other edge, since we have every edge as an outgoing |
| 101 | // and incoming egde |
| 102 | if (nbg_node_u >= nbg_node_v) |
| 103 | { |
| 104 | continue; |
| 105 | } |
| 106 | |
| 107 | auto from = nbg_node_u, to = nbg_node_v; |
| 108 | // if we found a non-forward edge reverse and try again |
| 109 | if (nbg_edge_data.reversed) |
| 110 | std::swap(from, to); |
| 111 | |
| 112 | // find forward edge id and |
| 113 | const EdgeID edge_id_1 = compressed_output_graph.FindEdge(from, to); |
| 114 | BOOST_ASSERT(edge_id_1 != SPECIAL_EDGEID); |
| 115 | |
| 116 | // find reverse edge id and |
| 117 | const EdgeID edge_id_2 = compressed_output_graph.FindEdge(to, from); |
| 118 | BOOST_ASSERT(edge_id_2 != SPECIAL_EDGEID); |
| 119 | |
| 120 | auto packed_geometry_id = compressed_edge_container.ZipEdges(edge_id_1, edge_id_2); |
| 121 | |
| 122 | // remember the geometry ID for both edges in the node-based graph |
| 123 | compressed_output_graph.GetEdgeData(edge_id_1).geometry_id = {packed_geometry_id, true}; |
| 124 | compressed_output_graph.GetEdgeData(edge_id_2).geometry_id = {packed_geometry_id, |
| 125 | false}; |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | void NodeBasedGraphFactory::CompressAnnotationData() |
| 131 | { |
nothing calls this directly
no test coverage detected