/srv/osrm/osrm-backend/include/extractor
NameSizeModeActions
intersection/-0755rm
class_data.hpp9810644editdlrm
compressed_edge_container.hpp33360644editdlrm
compressed_node_based_graph_edge.hpp4180644editdlrm
conditional_turn_penalty.hpp5890644editdlrm
datasources.hpp12070644editdlrm
edge_based_edge.hpp34670644editdlrm
edge_based_graph_factory.hpp77870644editdlrm
edge_based_node.hpp3830644editdlrm
edge_based_node_segment.hpp20500644editdlrm
extraction_containers.hpp36790644editdlrm
extraction_helper_functions.hpp48270644editdlrm
extraction_node.hpp4590644editdlrm
extraction_relation.hpp59490644editdlrm
extraction_segment.hpp7150644editdlrm
extraction_turn.hpp49830644editdlrm
extraction_way.hpp42680644editdlrm
extractor.hpp52670644editdlrm
extractor_callbacks.hpp32490644editdlrm
extractor_config.hpp30400644editdlrm
files.hpp243720644editdlrm
graph_compressor.hpp12710644editdlrm
internal_extractor_edge.hpp26420644editdlrm
intersection_bearings_container.hpp44870644editdlrm
location_dependent_data.hpp17970644editdlrm
maneuver_override.hpp54560644editdlrm
maneuver_override_relation_parser.hpp17850644editdlrm
name_table.hpp35960644editdlrm
nbg_to_ebg.hpp4500644editdlrm
nodes_of_way.hpp14110644editdlrm
node_based_edge.hpp80240644editdlrm
node_based_graph_factory.hpp51550644editdlrm
node_data_container.hpp45580644editdlrm
node_restriction_map.hpp22920644editdlrm
packed_osm_ids.hpp5200644editdlrm
profile_properties.hpp50290644editdlrm
query_node.hpp14110644editdlrm
raster_source.hpp50020644editdlrm
restriction.hpp17500644editdlrm
restriction_graph.hpp45000644editdlrm
restriction_parser.hpp17680644editdlrm
road_classification.hpp83900644editdlrm
scripting_environment.hpp24260644editdlrm
scripting_environment_lua.hpp42530644editdlrm
segment_data_container.hpp80320644editdlrm
serialization.hpp88340644editdlrm
suffix_table.hpp14070644editdlrm
traffic_lights.hpp5140644editdlrm
traffic_signals.hpp6560644editdlrm
travel_mode.hpp36660644editdlrm
turn_lane_types.hpp37540644editdlrm
turn_path.hpp74830644editdlrm
turn_path_compressor.hpp22200644editdlrm
turn_path_filter.hpp6690644editdlrm
way_restriction_map.hpp31140644editdlrm
Edit: /srv/osrm/osrm-backend/include/extractor/restriction_graph.hpp (4500B)
#ifndef OSRM_EXTRACTOR_RESTRICTION_GRAPH_HPP_ #define OSRM_EXTRACTOR_RESTRICTION_GRAPH_HPP_ #include #include "util/node_based_graph.hpp" #include "util/std_hash.hpp" #include "util/typedefs.hpp" #include namespace osrm::extractor { struct TurnRestriction; namespace restriction_graph_details { struct transferBuilder; struct pathBuilder; } // namespace restriction_graph_details struct RestrictionEdge { NodeID node_based_to; RestrictionID target; bool is_transfer; }; struct RestrictionNode { size_t restrictions_begin_idx; size_t num_restrictions; size_t edges_begin_idx; size_t num_edges; }; /** * The restriction graph is used to represent all possible restrictions within the routing graph. * The graph uses an edge-based node representation. Each node represents a compressed * node-based edge along a restriction path. * * Given a list of turn restrictions, the graph is created in multiple steps. * * INPUT * a -> b -> d: no_e * a -> b -> c: only_d * b -> c -> d: only_f * b -> c: no_g * e -> b -> d: no_g * * Step 1: create a disjoint union of prefix trees for all restriction paths. * The restriction instructions are added to the final node in its path. * * STEP 1 * (a,b) -> (b,d,[no_e]) * \->(b,c,[only_d]) * * (b,c,[no_g]) -> (c,d,[only_f]) * (e,b) -> (b,d,[no_g]) * * Step 2: add transfers between restriction paths that overlap. * We do this by traversing each restriction path, tracking where the suffix of our current path * matches the prefix of any other. If it does, there's opportunity to transfer to the suffix * restriction path *if* the transfer would not be restricted *and* that edge does not take us * further on our current path. Nested restrictions are also added from any of the suffix paths. * * STEP 2 * (a,b) -> (b,d,[no_e]) * \->(b,c,[only_d,no_g]) * \ * (b,c,[no_g]) -> \-> (c,d,[only_f]) * * (e,b) -> (b,d,[no_g]) * If a transfer applies to multiple suffix paths, we only add the edge to the largest suffix path. * This ensures we correctly track all overlapping paths. * * * Step 3: The nodes are split into * start nodes - compressed edges that are entry points into a restriction path. * via nodes - compressed edges that are intermediate steps along a restriction path. * Start nodes and via nodes are indexed by the compressed node-based edge for easy retrieval * * STEP 3 * Start Node Index * (a,b) => (a,b) * (b,c) => (b,c,[no_g]) * (e,b) => (e,b) * * Via Nodes Index * (b,c) => (b,c,[only_d,no_g]) * (b,d) => (b,d,[no_e]) , (b,d,[no_g]) * (c,d) => (c,d,[only_f]) * * Duplicate Nodes: * There is a 1-1 mapping between restriction graph via nodes and edge-based-graph duplicate nodes. * This relationship is used in the creation of restrictions in the routing edge-based graph. * */ struct RestrictionGraph { friend restriction_graph_details::pathBuilder; friend restriction_graph_details::transferBuilder; friend RestrictionGraph constructRestrictionGraph(const std::vector &); using EdgeRange = boost::iterator_range::const_iterator>; using RestrictionRange = boost::iterator_range::const_iterator>; using EdgeKey = std::pair; // Helper functions for iterating over node restrictions and edges EdgeRange GetEdges(RestrictionID id) const; RestrictionRange GetRestrictions(RestrictionID id) const; // A compressed node-based edge can only have one start node in the restriction graph. std::unordered_map start_edge_to_node{}; // A compressed node-based edge can have multiple via nodes in the restriction graph // (as the compressed edge can appear in paths with different prefixes). std::unordered_multimap via_edge_to_node{}; std::vector nodes; // TODO: Investigate reusing DynamicGraph. Currently it requires specific attributes // (e.g. reversed, weight) that would not make sense for restrictions. std::vector edges; std::vector restrictions; size_t num_via_nodes{}; private: RestrictionGraph() = default; }; RestrictionGraph constructRestrictionGraph(const std::vector &turn_restrictions); } // namespace osrm::extractor #endif // OSRM_EXTRACTOR_RESTRICTION_GRAPH_HPP_