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

Function makeGraph

unit_tests/customizer/cell_customization.cpp:24–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22};
23
24auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock_edges)
25{
26 struct EdgeData
27 {
28 EdgeWeight weight;
29 EdgeDuration duration;
30 EdgeDistance distance;
31 bool forward;
32 bool backward;
33 };
34 using Edge = static_graph_details::SortableEdgeWithData<EdgeData>;
35 std::vector<Edge> edges;
36 std::size_t max_id = 0;
37 for (const auto &m : mock_edges)
38 {
39 max_id = std::max<std::size_t>(max_id, std::max(m.start, m.target));
40 edges.push_back(Edge{m.start,
41 m.target,
42 m.weight,
43 EdgeDuration{2} * alias_cast<EdgeDuration>(m.weight),
44 EdgeDistance{1.0},
45 true,
46 false});
47 edges.push_back(Edge{m.target,
48 m.start,
49 m.weight,
50 EdgeDuration{2} * alias_cast<EdgeDuration>(m.weight),
51 EdgeDistance{1.0},
52 false,
53 true});
54 }
55 std::sort(edges.begin(), edges.end());
56 return partitioner::MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
57 mlp, max_id + 1, edges);
58}
59} // namespace
60
61BOOST_AUTO_TEST_SUITE(cell_customization_tests)

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.70

Calls 3

push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected