Skip to content

Commit 565aa70

Browse files
committed
Fix generation of inefficient MLD partitions
Duplicate restriction nodes in the edge-based-graph are currently not in included in a mapping (.osrm.cnbg_to_ebg) from node-based-graph edges to edge-based-graph nodes. This mapping is used by the MLD partitioner to assign EBG nodes to partitions. The omission from the mapping means all restriction nodes are included in a special 'invalid' partition. This special partition will break the geolocation properties of the multi-level hierarchy. The partition and its super levels will have a large number of border nodes and very few internal paths between them. Given the partitioner is the only consumer of the mapping, we fix the issue by including the duplicate restriction nodes in the mapping, so that they are correctly assigned to a partition. This has measurable improvement on MLD routing. For a country-sized routing network, the fix reduces routing and table request computation time by ~2% and ~6% respectively and reduces memory usage by X%.
1 parent dca35dc commit 565aa70

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Unreleased
2+
- Changes from 5.24.0
3+
- Routing:
4+
- FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084)
25

36
# 5.25.0
47
- Changes from 5.24.0

src/extractor/edge_based_graph_factory.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,13 @@ EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const WayRestrictionMap &way_re
412412
m_edge_based_node_distances.push_back(
413413
m_edge_based_node_distances[nbe_to_ebn_mapping[eid]]);
414414

415+
// Include duplicate nodes in cnbg to ebg mapping. This means a
416+
// compressed node pair (u,v) can appear multiple times in this list.
417+
// This is needed by the MLD partition step to ensure duplicate nodes
418+
// are also assigned to partitions (the MLD partitioner is currently
419+
// the only consumer of this mapping).
420+
mapping.push_back(NBGToEBG{node_u, node_v, edge_based_node_id, SPECIAL_NODEID});
421+
415422
edge_based_node_id++;
416423
progress.PrintStatus(progress_counter++);
417424
}

src/partitioner/partitioner.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ int Partitioner::Run(const PartitionerConfig &config)
118118
edge_based_partition_ids[backward_node] = node_based_partition_ids[v];
119119
}
120120

121+
BOOST_ASSERT(std::none_of(edge_based_partition_ids.begin(),
122+
edge_based_partition_ids.end(),
123+
[](auto x) { return x == SPECIAL_NODEID; }));
124+
121125
std::vector<Partition> partitions;
122126
std::vector<std::uint32_t> level_to_num_cells;
123127
std::tie(partitions, level_to_num_cells) =

0 commit comments

Comments
 (0)