@@ -16,8 +16,10 @@ namespace osrm
1616namespace customizer
1717{
1818
19- // TODO: Change to turn_id only
20- using EdgeBasedGraphEdgeData = partitioner::EdgeBasedGraphEdgeData;
19+ struct EdgeBasedGraphEdgeData
20+ {
21+ NodeID turn_id; // ID of the edge based node (node based edge)
22+ };
2123
2224template <typename EdgeDataT, storage::Ownership Ownership> class MultiLevelGraph ;
2325
@@ -39,8 +41,8 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
3941{
4042 private:
4143 using SuperT = partitioner::MultiLevelGraph<EdgeDataT, Ownership>;
42- using SuperC = partitioner::MultiLevelGraph<partitioner::EdgeBasedGraphEdgeData,
43- storage::Ownership::Container>;
44+ using PartitionerGraphT = partitioner::MultiLevelGraph<partitioner::EdgeBasedGraphEdgeData,
45+ storage::Ownership::Container>;
4446 template <typename T> using Vector = util::ViewOrVector<T, Ownership>;
4547
4648 public:
@@ -50,34 +52,49 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
5052 MultiLevelGraph &operator =(MultiLevelGraph &&) = default ;
5153 MultiLevelGraph &operator =(const MultiLevelGraph &) = default ;
5254
53- // TODO: add constructor for EdgeBasedGraphEdgeData
54- MultiLevelGraph (SuperC &&graph,
55+ MultiLevelGraph (PartitionerGraphT &&graph,
5556 Vector<EdgeWeight> node_weights_,
5657 Vector<EdgeDuration> node_durations_)
5758 : node_weights(std::move(node_weights_)), node_durations(std::move(node_durations_))
5859 {
60+ util::ViewOrVector<PartitionerGraphT::EdgeArrayEntry, storage::Ownership::Container>
61+ original_edge_array;
62+
5963 std::tie (SuperT::node_array,
60- SuperT::edge_array ,
64+ original_edge_array ,
6165 SuperT::node_to_edge_offset,
6266 SuperT::connectivity_checksum) = std::move (graph).data ();
63- // TODO: add EdgeArrayEntry shaving
67+
68+ SuperT::edge_array.reserve (original_edge_array.size ());
69+ for (const auto &edge : original_edge_array)
70+ {
71+ SuperT::edge_array.push_back ({edge.target , {edge.data .turn_id }});
72+ is_forward_edge.push_back (edge.data .forward );
73+ is_backward_edge.push_back (edge.data .backward );
74+ }
6475 }
6576
6677 MultiLevelGraph (Vector<typename SuperT::NodeArrayEntry> node_array_,
6778 Vector<typename SuperT::EdgeArrayEntry> edge_array_,
6879 Vector<typename SuperT::EdgeOffset> node_to_edge_offset_,
6980 Vector<EdgeWeight> node_weights_,
70- Vector<EdgeDuration> node_durations_)
81+ Vector<EdgeDuration> node_durations_,
82+ Vector<bool > is_forward_edge_,
83+ Vector<bool > is_backward_edge_)
7184 : SuperT(std::move(node_array_), std::move(edge_array_), std::move(node_to_edge_offset_)),
72- node_weights (std::move(node_weights_)), node_durations(std::move(node_durations_))
85+ node_weights (std::move(node_weights_)), node_durations(std::move(node_durations_)),
86+ is_forward_edge(is_forward_edge_), is_backward_edge(is_backward_edge_)
7387 {
74- // TODO: add EdgeArrayEntry shaving
7588 }
7689
7790 EdgeWeight GetNodeWeight (NodeID node) const { return node_weights[node]; }
7891
7992 EdgeWeight GetNodeDuration (NodeID node) const { return node_durations[node]; }
8093
94+ bool IsForwardEdge (EdgeID edge) const { return is_forward_edge[edge]; }
95+
96+ bool IsBackwardEdge (EdgeID edge) const { return is_backward_edge[edge]; }
97+
8198 friend void
8299 serialization::read<EdgeDataT, Ownership>(storage::tar::FileReader &reader,
83100 const std::string &name,
@@ -90,6 +107,8 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
90107 protected:
91108 Vector<EdgeWeight> node_weights;
92109 Vector<EdgeDuration> node_durations;
110+ Vector<bool > is_forward_edge;
111+ Vector<bool > is_backward_edge;
93112};
94113
95114using MultiLevelEdgeBasedGraph =
0 commit comments