MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / printUnreachableStatistics

Function printUnreachableStatistics

src/customize/customizer.cpp:33–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32template <typename Partition, typename CellStorage>
33void printUnreachableStatistics(const Partition &partition,
34 const CellStorage &storage,
35 const CellMetric &metric)
36{
37 util::Log() << "Unreachable nodes statistics per level";
38
39 for (std::size_t level = 1; level < partition.GetNumberOfLevels(); ++level)
40 {
41 auto num_cells = partition.GetNumberOfCells(level);
42 std::size_t invalid_sources = 0;
43 std::size_t invalid_destinations = 0;
44 for (std::uint32_t cell_id = 0; cell_id < num_cells; ++cell_id)
45 {
46 const auto &cell = storage.GetCell(metric, level, cell_id);
47 for (auto node : cell.GetSourceNodes())
48 {
49 const auto &weights = cell.GetOutWeight(node);
50 invalid_sources +=
51 std::all_of(weights.begin(),
52 weights.end(),
53 [](auto weight) { return weight == INVALID_EDGE_WEIGHT; });
54 }
55 for (auto node : cell.GetDestinationNodes())
56 {
57 const auto &weights = cell.GetInWeight(node);
58 invalid_destinations +=
59 std::all_of(weights.begin(),
60 weights.end(),
61 [](auto weight) { return weight == INVALID_EDGE_WEIGHT; });
62 }
63 }
64
65 if (invalid_sources > 0 || invalid_destinations > 0)
66 {
67 util::Log(logWARNING) << "Level " << level << " unreachable boundary nodes per cell: "
68 << (invalid_sources / (float)num_cells) << " sources, "
69 << (invalid_destinations / (float)num_cells) << " destinations";
70 }
71 }
72}
73
74auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
75 const partitioner::MultiLevelPartition &mlp,

Callers 1

RunMethod · 0.85

Calls 10

LogClass · 0.85
GetNumberOfLevelsMethod · 0.45
GetNumberOfCellsMethod · 0.45
GetCellMethod · 0.45
GetSourceNodesMethod · 0.45
GetOutWeightMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetDestinationNodesMethod · 0.45
GetInWeightMethod · 0.45

Tested by

no test coverage detected