|
MTCT
Design Automation and Optimization for ETCS Railway Networks
|
Directed multigraph representing a railway network. More...
#include <RailwayNetwork.hpp>
Classes | |
| struct | VertexInput |
| Unified vertex descriptor accepted by all public API functions. More... | |
| struct | EdgeInput |
| Unified edge descriptor accepted by all public API functions. More... | |
Public Member Functions | |
| Network (std::string_view const networkName="UnnamedNetwork") | |
| Default-constructs an empty network. | |
| Network (std::string_view network_name, std::filesystem::path const &working_directory) | |
| Reads a network from disk and constructs the object. | |
| Network (std::string_view const networkName, std::string const &working_directory) | |
| Convenience overload accepting a std::string path. | |
| Network (std::string_view const networkName, char const *const workingDirectory) | |
| Convenience overload accepting a C-string path. | |
| void | export_network (std::filesystem::path const &working_directory) const |
| Exports the network to disk. | |
| void | export_network (std::string const &working_directory) const |
| Convenience overload of export_network accepting a std::string path. | |
| void | export_network (char const *const workingDirectory) const |
| Convenience overload of export_network accepting a C-string path. | |
| bool | has_vertex (size_t index) const |
| Checks whether a numeric vertex index is valid. | |
| bool | has_vertex (std::string_view const name) const |
| Checks whether a vertex with the given name exists. | |
| bool | has_edge (size_t const index) const |
| Checks whether a numeric edge index is valid. | |
| bool | has_edge (VertexInput const &source, VertexInput const &target) const |
| Checks whether a directed edge between two vertices exists. | |
| bool | is_valid_successor (EdgeInput const &edge_in, EdgeInput const &edge_out) const |
Checks whether edge_out is a valid successor of edge_in. | |
| bool | is_adjustable (VertexInput const &vertex) const |
| Checks whether a vertex is adjustable by certain algorithmic approaches. | |
| bool | is_consistent_for_transformation () const |
| Checks network consistency required for edge-separation transformations. | |
| bool | has_reversal_free_successors () const |
| Checks that no successor lets a train reverse its direction of travel. | |
| size_t | number_of_vertices () const |
| Returns the total number of vertices in the network. | |
| size_t | number_of_edges () const |
| Returns the total number of edges in the network. | |
| std::string const & | get_network_name () const |
| Returns the network name. | |
| std::vector< Vertex > const & | get_vertices () const |
| Returns a const reference to the underlying vertex container. | |
| cda_rail::index_vector | get_vertices_by_type (VertexType type) const |
| Returns the indices of all vertices of the specified type, ordered by vertex index. | |
| const std::vector< Edge > & | get_edges () const |
| Returns a const reference to the underlying edge container. | |
| std::pair< size_t, double > | get_old_edge (EdgeInput const &edge) const |
| Returns the pre-discretization edge and position for an edge that may have been created by a transformation. | |
| cda_rail::index_vector | get_old_path (const cda_rail::index_vector &path) const |
Returns the path of the network before its transformations that corresponds to path. | |
| void | reset_old_edges () |
| Forgets from which edges earlier transformations derived the edges, so that get_old_edge and get_old_path refer to the network as it is now. | |
| size_t | get_vertex_index (std::string_view name) const |
| Returns the index of the vertex with the given name. | |
| size_t | resolve_vertex_index (VertexInput const &vertex) const |
| Resolves a vertex descriptor to its numeric vertex index. | |
| const Vertex & | get_vertex (VertexInput const &vertex) const |
| Returns a const reference to the specified vertex. | |
| size_t | get_edge_index (VertexInput const &source, VertexInput const &target) const |
Returns the index of the directed edge from source to target. | |
| size_t | get_edge_index (EdgeInput const &edge_input) const |
| Resolves an edge descriptor to its numeric edge index. | |
| const Edge & | get_edge (EdgeInput const &edge) const |
| Returns a const reference to the specified edge. | |
| std::string | get_edge_name (EdgeInput const &edge) const |
| Returns the canonical name of an edge formatted as "<source_name>-<target_name>". | |
| cda_rail::index_set | out_edges (VertexInput const &vertex) const |
Returns the set of edge indices of all edges leaving vertex. | |
| cda_rail::index_set | in_edges (VertexInput const &vertex) const |
Returns the set of edge indices of all edges entering vertex. | |
| cda_rail::index_set | neighboring_edges (VertexInput const &vertex) const |
Returns the set of edge indices of all edges incident to vertex (both in-edges and out-edges). | |
| cda_rail::index_set | get_predecessors (EdgeInput const &edge) const |
Returns all predecessor edges of edge. | |
| cda_rail::index_set const & | get_successors (EdgeInput const &edge) const |
Returns the set of valid successor edges for edge. | |
| cda_rail::index_set | edges_on_paths_between (VertexInput const &source, VertexInput const &target) const |
Returns all edges that lie on some path from source to target. | |
| cda_rail::index_set | neighbors (VertexInput const &vertex) const |
Returns the set of vertex indices adjacent to vertex via any incident edge. | |
| std::optional< size_t > | common_vertex (EdgeInput const &edge1, EdgeInput const &edge2) const |
| Returns the common endpoint of two edges, if one exists. | |
| std::optional< size_t > | get_reverse_edge_index (EdgeInput const &edge) const |
Returns the index of the edge with reversed endpoints relative to edge. | |
| std::optional< cda_rail::index_vector > | get_reverse_path (cda_rail::index_vector const &edges) const |
| Get reverse path. | |
| std::optional< size_t > | get_optional_reverse_edge_index (std::optional< size_t > const edgeIndex) const |
| Wraps get_reverse_edge_index to propagate an optional input. | |
| std::vector< std::pair< std::optional< size_t >, std::optional< size_t > > > | combine_reverse_edges (const cda_rail::index_vector &edges_to_consider, bool sort=false) const |
Pairs each edge in edges_to_consider with its reverse edge, eliminating duplicate pairs. | |
| size_t | get_track_index (EdgeInput const &edge) const |
Returns the canonical track index for edge. | |
| cda_rail::index_vector | breakable_edges () const |
| Returns the indices of all breakable edges, sorted by index. | |
| cda_rail::index_vector | relevant_breakable_edges () const |
| Returns the indices of breakable edges, counting each bidirectional track only once. | |
| std::vector< cda_rail::index_set > | unbreakable_sections () const |
| Returns all unbreakable sections of the network. | |
| std::vector< cda_rail::index_set > | no_border_vss_sections () const |
| Returns all sections bounded by NoBorderVSS vertices. | |
| cda_rail::index_set | get_unbreakable_section_containing_edge (EdgeInput const &edge) const |
Returns the set of edge indices that form the unbreakable section containing edge. | |
| bool | is_on_same_unbreakable_section (EdgeInput const &edge1, EdgeInput const &edge2) const |
| Checks whether two edges belong to the same unbreakable section. | |
| cda_rail::index_set | vertices_used_by_edges (const cda_rail::index_set &edges_tmp) const |
Returns all vertex indices that are endpoints of at least one edge in edges_tmp. | |
| cda_rail::index_set | edge_set_complement (const cda_rail::index_set &edge_indices) const |
Returns the set of all network edge indices not in edge_indices. | |
| cda_rail::index_set | edge_set_complement (const cda_rail::index_set &edge_indices, const cda_rail::index_set &edges_to_consider) const |
Returns edges_to_consider minus edge_indices. | |
| double | maximal_vertex_speed (VertexInput const &vertex, const cda_rail::index_set &edges_to_consider={}) const |
Returns the maximum speed achievable at vertex. | |
| double | minimal_neighboring_edge_length (VertexInput const &vertex, const cda_rail::index_set &edges_to_consider={}) const |
Returns the length of the shortest edge incident to vertex. | |
| size_t | max_vss_on_edge (EdgeInput const &edge) const |
Returns the maximum number of VSS borders that can be placed on edge. | |
| size_t | max_vss_on_edge (EdgeInput const &edge, const vss::SeparationFunction &sep_func) const |
Returns the maximum number of VSS borders that can be placed on edge if their positions are given by sep_func. | |
| void | set_network_name (std::string_view const networkName) |
| Sets the network name. | |
| void | change_vertex_name (VertexInput const &vertex, std::string_view const newName) |
| Renames a vertex. | |
| void | change_vertex_type (VertexInput const &vertex, VertexType const newType) |
| Changes the type of a vertex. | |
| void | change_vertex_headway (VertexInput const &vertex, double const newHeadway) |
| Updates the additional headway imposed on a vertex. | |
| void | change_edge_length (EdgeInput const &edge, double new_length) |
| Changes the length of an edge. | |
| void | change_edge_max_speed (EdgeInput const &edge, double new_max_speed) |
| Changes the maximum speed of an edge. | |
| void | change_edge_min_block_length (EdgeInput const &edge, double new_min_block_length) |
| Changes the minimum block length of an edge. | |
| void | change_edge_min_stop_block_length (EdgeInput const &edge, double new_min_stop_block_length) |
| Changes the minimum stop-block length of an edge. | |
| void | set_edge_breakable (EdgeInput const &edge) |
| Marks an edge as breakable (VSS borders may be placed on it). | |
| void | set_edge_unbreakable (EdgeInput const &edge) |
| Marks an edge as unbreakable (no VSS borders may be placed on it). | |
| void | change_edge_breakable_status (EdgeInput const &edge, bool const breakable) |
| Sets the breakable flag of an edge. | |
| size_t | add_vertex (Vertex vertex) |
| Adds a vertex to the network. | |
| size_t | add_vertex (std::string_view name, VertexType type, double headway=Vertex::HEADWAY_DEFAULT) |
| Constructs a vertex and adds it to the network. | |
| size_t | add_vertex (std::string_view name, VertexType type, std::optional< double > const &headway) |
| Constructs a vertex and adds it to the network. | |
| size_t | add_edge (VertexInput const &source, VertexInput const &target, double const length, double const maxSpeed, std::optional< bool > const &breakable={}, std::optional< double > const &min_block_length={}, std::optional< double > const &min_stop_block_length={}) |
| Adds a directed edge between two vertices. | |
| std::pair< size_t, size_t > | add_bidirectional_edge (VertexInput const &source, VertexInput const &target, double length, double max_speed, std::optional< bool > const &breakable={}, std::optional< double > const &min_block_length={}, std::optional< double > const &min_stop_block_length={}) |
| Adds a bidirectional edge between two vertices, i.e., it adds two edges, one in each direction. | |
| void | add_successor (EdgeInput const &edge_in, EdgeInput const &edge_out) |
Registers edge_out as a valid successor of edge_in. | |
| void | add_trivial_successors () |
| Lets trains pass straight through every vertex with exactly two neighbors. | |
| void | add_turnout_successors (VertexInput const &turnout, VertexInput const &toe, VertexInput const &branch_1, VertexInput const &branch_2) |
| Registers the successors of a simple turnout. | |
| void | add_crossing_successors (VertexInput const &crossing, VertexInput const &track_1_a, VertexInput const &track_1_b, VertexInput const &track_2_a, VertexInput const &track_2_b) |
| Registers the successors of a diamond crossing, where two tracks cross without being connected. | |
| void | add_double_slip_successors (VertexInput const &double_slip, VertexInput const &track_1_a, VertexInput const &track_1_b, VertexInput const &track_2_a, VertexInput const &track_2_b) |
| Registers the successors of a double slip switch, i.e., a diamond crossing whose tracks are additionally connected on both sides. | |
| std::pair< cda_rail::index_vector, cda_rail::index_vector > | separate_edge (EdgeInput const &edge, const vss::SeparationFunction &sep_func=vss::UNIFORM) |
Separates a breakable edge (and its reverse, if present) into multiple sub-edges according to sep_func and the edge's min_block_length. | |
| std::pair< cda_rail::index_vector, cda_rail::index_vector > | separate_stop_edge (EdgeInput const &edge) |
| Separates a breakable edge using min_stop_block_length with uniform separation. | |
| std::vector< std::pair< size_t, cda_rail::index_vector > > | separate_stop_edges (const cda_rail::index_set &stop_edges) |
Separates all edges in stop_edges whose length is at least twice their min_stop_block_length. | |
| std::vector< std::pair< size_t, cda_rail::index_vector > > | discretize (const vss::SeparationFunction &sep_func=vss::UNIFORM) |
| Discretizes all relevant breakable edges, inserting new NoBorderVSS vertices so that VSS borders are only permitted at those vertex positions. | |
| std::vector< std::pair< size_t, cda_rail::index_vector > > | separate_edges_at_vss (const std::vector< std::vector< double > > &vss_positions) |
| Splits the breakable edges at the given positions, which become VSS border vertices. | |
| std::vector< cda_rail::index_vector > | all_paths_of_length_starting_in_vertex (size_t v, double desired_len, std::optional< size_t > exit_node={}, const cda_rail::index_set &edges_to_consider={}, bool return_successors_if_zero=false) const |
Returns all edge paths of length at least desired_len starting at vertex v. | |
| std::vector< cda_rail::index_vector > | all_paths_of_length_starting_in_edge (size_t e, double desired_len, std::optional< size_t > exit_node={}, const cda_rail::index_set &edges_to_consider={}) const |
Returns all edge paths of length at least desired_len starting immediately after edge e (i.e., at the target of e). | |
| std::vector< cda_rail::index_vector > | all_paths_of_length_ending_in_vertex (size_t v, double desired_len, std::optional< size_t > exit_node={}, const cda_rail::index_set &edges_to_consider={}) const |
Returns all edge paths of length at least desired_len ending at vertex v (paths are listed from source side towards v). | |
| std::vector< cda_rail::index_vector > | all_paths_of_length_ending_in_edge (size_t const e, double const desiredLen, std::optional< size_t > exit_node={}, const cda_rail::index_set &edges_to_consider={}) const |
Returns all edge paths of length at least desiredLen ending at edge e. | |
| std::vector< cda_rail::index_vector > | all_paths_ending_at_ttd (EdgeInput const &edge, const std::vector< cda_rail::index_set > &ttd_sections, std::optional< size_t > exit_node={}, bool skip_irrelevant_ttds=false, bool zero_length_if_next_edge_is_ttd=false) const |
Returns all paths starting immediately after edge e_0 and ending upon entering a TTD section or reaching the exit vertex if specified. | |
| double | length_of_path (const cda_rail::index_vector &path) const |
| Computes the total length of a path given as an ordered sequence of edge indices. | |
| std::vector< std::vector< double > > | all_edge_pairs_shortest_paths () const |
| Computes the shortest-path distance matrix between all ordered edge pairs using the Floyd–Warshall algorithm. | |
| std::optional< double > | shortest_path_from_edge_to_edge (EdgeInput const &source_edge, EdgeInput const &target_edge, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the shortest distance from source_edge to target_edge. | |
| std::optional< double > | shortest_path_from_edge_to_vertex (EdgeInput const &source_edge, VertexInput const &target_vertex, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the shortest distance from source_edge to target_vertex. | |
| std::vector< double > | shortest_path_lengths_to_all_vertices (const cda_rail::index_set &source_edge_ids, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the shortest distance from any edge in source_edge_ids to every vertex of the network. | |
| std::pair< std::optional< double >, cda_rail::index_vector > | shortest_edge_to_edge_path (EdgeInput const &source_edge, EdgeInput const &target_edge, bool only_use_valid_successors=true, const cda_rail::index_set &edges_to_use={}, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the shortest path and its length from source_edge to target_edge. | |
| std::pair< std::optional< double >, cda_rail::index_vector > | shortest_edge_to_vertex_path (EdgeInput const &source_edge, VertexInput const &target_vertex, bool only_use_valid_successors=true, const cda_rail::index_set &edges_to_use={}, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the shortest path and its length from source_edge to target_vertex. | |
| std::pair< std::optional< double >, cda_rail::index_vector > | shortest_path_between_edge_sets (const cda_rail::index_set &source_edge_ids, const cda_rail::index_set &target_edge_ids, bool only_use_valid_successors=true, const cda_rail::index_set &edges_to_use={}, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the shortest path and distance from any edge in source_edge_ids to any edge in target_edge_ids. | |
| std::pair< std::optional< double >, cda_rail::index_vector > | shortest_path_between_edge_and_vertex_set (const cda_rail::index_set &source_edge_ids, const cda_rail::index_set &target_vertex_ids, bool only_use_valid_successors=true, const cda_rail::index_set &edges_to_use={}, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the shortest path and distance from any edge in source_edge_ids to any vertex in target_vertex_ids. | |
| std::optional< double > | shortest_path_length_between_edge_sets (const cda_rail::index_set &source_edge_ids, const cda_rail::index_set &target_ids, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the length of the shortest path from any edge in source_edge_ids to any edge in target_ids. | |
| std::optional< double > | shortest_path_length_between_edge_and_vertex_set (const cda_rail::index_set &source_edge_ids, const cda_rail::index_set &target_vertex_ids, bool include_first_edge=false, bool use_minimal_time=false, double max_v=INF) const |
Returns the length of the shortest path from any edge in source_edge_ids to any vertex in target_vertex_ids. | |
| std::unordered_set< size_t > | get_border_vertices_of_ttd (const cda_rail::index_set &ttd_section) const |
| Returns the border vertices of a given TTD section. | |
| bool | has_ttd_path (VertexInput const &source_vertex, VertexInput const &target_vertex, const cda_rail::index_set &ttd_section) const |
| Checks if a TTD can be traversed from a given source to target. | |
| bool | has_ttd_path_not_using_border_vertex (VertexInput const &border_vertex, const cda_rail::index_set &ttd_section) const |
| Checks if a TTD can be traversed without using a given border vertex. | |
| void | throw_if_not_valid_successor (EdgeInput const &edge_in, EdgeInput const &edge_out) const |
Checks that edge_out may be used directly after edge_in. | |
Static Public Member Functions | |
| static Network | import_network (std::string_view const networkName, std::filesystem::path const &working_directory) |
| Loads a network from disk and returns it by value. | |
| static Network | import_network (std::string_view const networkName, std::string const &working_directory) |
| Convenience overload of import_network accepting a std::string path. | |
| static Network | import_network (std::string_view const networkName, char const *const workingDirectory) |
| Convenience overload of import_network accepting a C-string path. | |
| static std::vector< std::pair< size_t, size_t > > | get_intersecting_ttd (const cda_rail::index_vector &edges, const std::vector< cda_rail::index_set > &ttd) |
For each TTD section that intersects edges, returns the TTD index together with the position of the first (entering) edge within edges. | |
| static std::optional< size_t > | get_ttd_of_edge (size_t e_0, const std::vector< cda_rail::index_set > &ttd_sections) |
| Returns the index of the TTD section that contains a given edge. | |
Directed multigraph representing a railway network.
Stores vertices, directed edges, and the edge-successor relation that encodes which continuations are physically possible at each junction. The class also provides import/export, graph queries, network transformations (edge discretization), and shortest-path algorithms.
|
inlineexplicit |
Default-constructs an empty network.
| networkName | Name of the network, used for export folder naming; defaults to "UnnamedNetwork". |
| cda_rail::exceptions::InvalidInputException | If networkName is not a valid folder name. |
|
explicit |
Reads a network from disk and constructs the object.
The graph (tracks.graphml) and the successor map (successors_cpp.json) are read from working_directory/networks/networkName/.
| network_name | Name of the network subfolder; defaults to "UnnamedNetwork". |
| working_directory | Root working directory. |
| cda_rail::exceptions::ImportException | If the expected directory does not exist or the files cannot be parsed. |
|
inlineexplicit |
Convenience overload accepting a std::string path.
| networkName | Name of the network subfolder. |
| working_directory | Root working directory as a string. |
| cda_rail::exceptions::ImportException | If the network cannot be loaded. |
|
inlineexplicit |
Convenience overload accepting a C-string path.
| networkName | Name of the network subfolder. |
| workingDirectory | Root working directory as a C-string. |
| cda_rail::exceptions::ImportException | If the network cannot be loaded. |
| std::pair< size_t, size_t > cda_rail::Network::add_bidirectional_edge | ( | VertexInput const & | source, |
| VertexInput const & | target, | ||
| double | length, | ||
| double | max_speed, | ||
| std::optional< bool > const & | breakable = {}, | ||
| std::optional< double > const & | min_block_length = {}, | ||
| std::optional< double > const & | min_stop_block_length = {} ) |
Adds a bidirectional edge between two vertices, i.e., it adds two edges, one in each direction.
| source | Source vertex descriptor. |
| target | Target vertex descriptor. |
| length | Edge length in metres. |
| max_speed | Maximum speed in m/s. |
| breakable | Whether VSS borders may be placed on this edge; std::nullopt uses Edge::BREAKABLE_DEFAULT. |
| min_block_length | Minimum block length in metres; std::nullopt uses Edge::MIN_BLOCK_LENGTH_DEFAULT. |
| min_stop_block_length | Minimum stop-block length in metres; std::nullopt uses Edge::MIN_STOP_BLOCK_LENGTH_DEFAULT. |
| cda_rail::exceptions::InvalidInputException | If source equals target or the edge already exists. |
| cda_rail::exceptions::VertexNotExistentException | If either vertex does not exist. |
| void cda_rail::Network::add_crossing_successors | ( | VertexInput const & | crossing, |
| VertexInput const & | track_1_a, | ||
| VertexInput const & | track_1_b, | ||
| VertexInput const & | track_2_a, | ||
| VertexInput const & | track_2_b ) |
Registers the successors of a diamond crossing, where two tracks cross without being connected.
Trains pass straight through crossing on the first track, i.e., between track_1_a and track_1_b, and on the second track, i.e., between track_2_a and track_2_b. Each successor is only registered if both of its edges exist.
| crossing | Vertex descriptor of the crossing. |
| track_1_a | Neighbor of crossing on one side of the first track. |
| track_1_b | Neighbor of crossing on the other side of the first track. |
| track_2_a | Neighbor of crossing on one side of the second track. |
| track_2_b | Neighbor of crossing on the other side of the second track. |
| cda_rail::exceptions::InvalidInputException | If the four tracks are not exactly the neighbors of crossing. |
| void cda_rail::Network::add_double_slip_successors | ( | VertexInput const & | double_slip, |
| VertexInput const & | track_1_a, | ||
| VertexInput const & | track_1_b, | ||
| VertexInput const & | track_2_a, | ||
| VertexInput const & | track_2_b ) |
Registers the successors of a double slip switch, i.e., a diamond crossing whose tracks are additionally connected on both sides.
track_1_a and track_2_a lie on the same side of double_slip, and track_1_b and track_2_b on the other. Trains coming from either vertex of one side may continue to either vertex of the other side. Each successor is only registered if both of its edges exist.
| double_slip | Vertex descriptor of the double slip switch. |
| track_1_a | Neighbor of double_slip on one side of the first track. |
| track_1_b | Neighbor of double_slip on the other side of the first track. |
| track_2_a | Neighbor of double_slip on one side of the second track, the same side as track_1_a. |
| track_2_b | Neighbor of double_slip on the other side of the second track, the same side as track_1_b. |
| cda_rail::exceptions::InvalidInputException | If the four tracks are not exactly the neighbors of double_slip. |
|
inline |
Adds a directed edge between two vertices.
| source | Source vertex descriptor. |
| target | Target vertex descriptor. |
| length | Edge length in metres. |
| maxSpeed | Maximum speed in m/s. |
| breakable | Whether VSS borders may be placed on this edge; std::nullopt uses Edge::BREAKABLE_DEFAULT. |
| min_block_length | Minimum block length in metres; std::nullopt uses Edge::MIN_BLOCK_LENGTH_DEFAULT. |
| min_stop_block_length | Minimum stop-block length in metres; std::nullopt uses Edge::MIN_STOP_BLOCK_LENGTH_DEFAULT. |
| cda_rail::exceptions::InvalidInputException | If source equals target or the edge already exists. |
| cda_rail::exceptions::VertexNotExistentException | If either vertex does not exist. |
|
inline |
Registers edge_out as a valid successor of edge_in.
The edges must be adjacent (target of edge_in == source of edge_out). If the relation already exists the call is a no-op.
| edge_in | Predecessor edge descriptor. |
| edge_out | Successor edge descriptor to register. |
| cda_rail::exceptions::EdgeNotExistentException | If either edge does not exist. |
| cda_rail::exceptions::ConsistencyException | If the edges are not adjacent. |
| void cda_rail::Network::add_trivial_successors | ( | ) |
Lets trains pass straight through every vertex with exactly two neighbors.
For a vertex v with neighbors u and w, (u, v) -> (v, w) and (w, v) -> (v, u) are registered, each only if both of its edges exist. An edge never becomes a successor of its reverse edge.
| void cda_rail::Network::add_turnout_successors | ( | VertexInput const & | turnout, |
| VertexInput const & | toe, | ||
| VertexInput const & | branch_1, | ||
| VertexInput const & | branch_2 ) |
Registers the successors of a simple turnout.
Trains coming from toe may continue to either branch, and trains coming from either branch continue to toe. A train can never move from one branch to the other. Each successor is only registered if both of its edges exist.
| turnout | Vertex descriptor of the turnout. |
| toe | Neighbor of turnout from which both branches can be reached. |
| branch_1 | Neighbor of turnout on the first branch. |
| branch_2 | Neighbor of turnout on the second branch. |
| cda_rail::exceptions::InvalidInputException | If toe, branch_1 and branch_2 are not exactly the neighbors of turnout. |
|
inline |
Constructs a vertex and adds it to the network.
| name | Name of the vertex. |
| type | Type of the vertex. |
| headway | Additional minimal headway at the vertex in s. |
| cda_rail::exceptions::InvalidInputException | If a vertex with the same name already exists. |
|
inline |
Constructs a vertex and adds it to the network.
| name | Name of the vertex. |
| type | Type of the vertex. |
| headway | Additional minimal headway at the vertex in s; std::nullopt uses Vertex::HEADWAY_DEFAULT. |
| cda_rail::exceptions::InvalidInputException | If a vertex with the same name already exists. |
| size_t cda_rail::Network::add_vertex | ( | Vertex | vertex | ) |
Adds a vertex to the network.
| vertex | Vertex object to add. |
| cda_rail::exceptions::InvalidInputException | If a vertex with the same name already exists. |
|
nodiscard |
Computes the shortest-path distance matrix between all ordered edge pairs using the Floyd–Warshall algorithm.
Entry [u][v] stores the shortest distance from the target of edge u to the target of edge v using only valid successors. Entries where no path exists are set to INF.
|
inlinenodiscard |
Returns all paths starting immediately after edge e_0 and ending upon entering a TTD section or reaching the exit vertex if specified.
| edge | Starting edge (paths begin with a valid successor of this edge). |
| ttd_sections | Vector of TTD sections (each a set of edge indices). |
| exit_node | Optional vertex at which paths may terminate. |
| skip_irrelevant_ttds | If true, TTD sections are traversed if there if every path through TTD contains the entry node as entry or exit. In this case it is not possible for another train to traverse the TTD while a train waits at the specified entry node. Hence, the train can safely traverse through the TTD since it will never have to wait. |
| zero_length_if_next_edge_is_ttd | If true, a path of length zero is returned if the first edge after e_0 is already part of a (new) TTD section. This reflects that a train could also wait before entering a TTD. If false, the train is forced to move at least one edge. |
|
inlinenodiscard |
Returns all edge paths of length at least desiredLen ending at edge e.
| e | Terminal edge index. |
| desiredLen | Minimum path length in metres. |
| exit_node | Optional additional vertex constraint. |
| edges_to_consider | If non-empty, only these edges are used. |
|
inlinenodiscard |
Returns all edge paths of length at least desired_len ending at vertex v (paths are listed from source side towards v).
| v | Terminal vertex index. |
| desired_len | Minimum path length in metres. |
| exit_node | Optional additional vertex constraint. |
| edges_to_consider | If non-empty, only these edges are used. |
|
inlinenodiscard |
Returns all edge paths of length at least desired_len starting immediately after edge e (i.e., at the target of e).
| e | Starting edge index. |
| desired_len | Minimum path length in metres. |
| exit_node | Optional vertex at which a path may terminate early. |
| edges_to_consider | If non-empty, only these edges are used. |
|
inlinenodiscard |
Returns all edge paths of length at least desired_len starting at vertex v.
A path is included if its total length is at least desired_len, but removing the last edge would make it too short.
| v | Starting vertex index. |
| desired_len | Minimum path length in metres. |
| exit_node | If set, a path may terminate at this vertex even before reaching desired_len. |
| edges_to_consider | If non-empty, only these edges are used. |
| return_successors_if_zero | If true and desired_len is 0, single-edge paths for each outgoing edge are returned. |
|
nodiscard |
Returns the indices of all breakable edges, sorted by index.
|
inline |
Sets the breakable flag of an edge.
| edge | Edge descriptor. |
| breakable | New breakable status. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inline |
Changes the length of an edge.
| edge | Edge descriptor. |
| new_length | New length in metres. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inline |
Changes the maximum speed of an edge.
| edge | Edge descriptor. |
| new_max_speed | New maximum speed in m/s. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inline |
Changes the minimum block length of an edge.
| edge | Edge descriptor. |
| new_min_block_length | New minimum block length in metres. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inline |
Changes the minimum stop-block length of an edge.
| edge | Edge descriptor. |
| new_min_stop_block_length | New minimum stop-block length in metres. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inline |
Updates the additional headway imposed on a vertex.
| vertex | Vertex descriptor. |
| newHeadway | New headway value in seconds. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
inline |
Renames a vertex.
| vertex | Vertex descriptor. |
| newName | New name for the vertex. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
| cda_rail::exceptions::InvalidInputException | If a vertex with newName already exists. |
|
inline |
Changes the type of a vertex.
| vertex | Vertex descriptor. |
| newType | New vertex type. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
nodiscard |
Pairs each edge in edges_to_consider with its reverse edge, eliminating duplicate pairs.
Each bidirectional track produces exactly one pair (e, rev_e) where the smaller index comes first. Edges without a reverse in edges_to_consider are paired with std::nullopt as the second element.
If the output is sorted, it is ensured that the first element edges are successors of each other, hence, the inner-pair order might be off. In this case it is also required that edges_to_consider includes every possible reverse edge if existent.
| edges_to_consider | Ordered vector of edge indices to process. All indices must refer to existing edges. |
| sort | If true, the returned pairs are reordered so that consecutive pairs share a vertex (valid only when edges_to_consider forms a simple path). |
| cda_rail::exceptions::EdgeNotExistentException | If any edge in edges_to_consider does not exist. |
|
inlinenodiscard |
Returns the common endpoint of two edges, if one exists.
| edge1 | First edge descriptor. |
| edge2 | Second edge descriptor. |
| cda_rail::exceptions::ConsistencyException | If the edges share more than one vertex. |
| std::vector< std::pair< size_t, cda_rail::index_vector > > cda_rail::Network::discretize | ( | const vss::SeparationFunction & | sep_func = vss::UNIFORM | ) |
Discretizes all relevant breakable edges, inserting new NoBorderVSS vertices so that VSS borders are only permitted at those vertex positions.
| sep_func | Separation function that controls the placement of the new vertices; defaults to uniform separation. |
|
nodiscard |
Returns the set of all network edge indices not in edge_indices.
| edge_indices | Set of edge indices to exclude. |
| cda_rail::exceptions::EdgeNotExistentException | If any index in edge_indices is invalid. |
|
nodiscard |
Returns edges_to_consider minus edge_indices.
| edge_indices | Set of edge indices to exclude. |
| edges_to_consider | Set of edge indices to restrict to. |
| cda_rail::exceptions::EdgeNotExistentException | If any index in either argument set is invalid. |
|
inlinenodiscard |
Returns all edges that lie on some path from source to target.
A path starts with an edge leaving source, ends with an edge entering target, and only follows valid successors. A train entering the network at source and leaving it at target can use no other edge.
| cda_rail::exceptions::VertexNotExistentException | If a vertex does not exist. |
|
inline |
Convenience overload of export_network accepting a C-string path.
| workingDirectory | Root working directory as a C-string. |
| cda_rail::exceptions::ExportException | If the output directory cannot be created. |
| void cda_rail::Network::export_network | ( | std::filesystem::path const & | working_directory | ) | const |
Exports the network to disk.
Writes tracks.graphml and successors_cpp.json to working_directory/networks/<networkName>/.
| working_directory | Root working directory. |
| cda_rail::exceptions::ExportException | If the output directory cannot be created. |
|
inline |
Convenience overload of export_network accepting a std::string path.
| working_directory | Root working directory as a string. |
| cda_rail::exceptions::ExportException | If the output directory cannot be created. |
|
nodiscard |
Returns the border vertices of a given TTD section.
A border vertex is a vertex with only one neighbor within the TTD.
| ttd_section | Edges within the TTD section |
Returns a const reference to the specified edge.
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inlinenodiscard |
Resolves an edge descriptor to its numeric edge index.
| edge_input | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
| cda_rail::exceptions::ConsistencyException | If an Edge object conflicts with the stored edge data. |
|
inlinenodiscard |
Returns the index of the directed edge from source to target.
| source | Source vertex descriptor. |
| target | Target vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If either vertex does not exist. |
| cda_rail::exceptions::EdgeNotExistentException | If no such directed edge exists. |
|
inlinenodiscard |
Returns the canonical name of an edge formatted as "<source_name>-<target_name>".
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inlinenodiscard |
Returns a const reference to the underlying edge container.
|
staticnodiscard |
For each TTD section that intersects edges, returns the TTD index together with the position of the first (entering) edge within edges.
| edges | Ordered vector of edge indices representing a path. |
| ttd | Vector of TTD sections (each a set of edge indices). |
edges.
|
inlinenodiscard |
Returns the network name.
|
inlinenodiscard |
Returns the pre-discretization edge and position for an edge that may have been created by a transformation.
If edge has not been produced by any transformation, returns {edge_index, 0.0}.
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
nodiscard |
Returns the path of the network before its transformations that corresponds to path.
Consecutive edges into which one edge was separated, see get_old_edge, are replaced by that edge, so that a route of the transformed network becomes the same route of the original network.
| path | Edge indices of a path of this network. |
| cda_rail::exceptions::EdgeNotExistentException | If an edge does not exist. |
|
inlinenodiscard |
Wraps get_reverse_edge_index to propagate an optional input.
If edgeIndex has no value, std::nullopt is returned immediately without any look-up.
| edgeIndex | Optional numeric edge index to query. |
|
inlinenodiscard |
Returns all predecessor edges of edge.
An edge e' is a predecessor of edge if edge is a valid successor of e'.
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inlinenodiscard |
Returns the index of the edge with reversed endpoints relative to edge.
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If edge does not exist. |
|
nodiscard |
Get reverse path.
| edges | Vector of edge indices. |
|
inlinenodiscard |
Returns the set of valid successor edges for edge.
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inlinenodiscard |
Returns the canonical track index for edge.
For a bidirectional track the canonical index is the smaller of the two directed edge indices.
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
staticnodiscard |
Returns the index of the TTD section that contains a given edge.
| e_0 | Edge index to look up. |
| ttd_sections | Collection of TTD sections. |
e_0.
|
inlinenodiscard |
Returns the set of edge indices that form the unbreakable section containing edge.
If edge is breakable the returned set is empty.
| edge | Edge descriptor. |
edge. | cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inlinenodiscard |
Returns a const reference to the specified vertex.
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
nodiscard |
Returns the index of the vertex with the given name.
| name | Vertex name. |
| cda_rail::exceptions::VertexNotExistentException | If no vertex with name exists. |
|
inlinenodiscard |
Returns a const reference to the underlying vertex container.
|
nodiscard |
Returns the indices of all vertices of the specified type, ordered by vertex index.
| type | Vertex type to filter by. |
type.
|
inlinenodiscard |
Checks whether a numeric edge index is valid.
| index | Candidate edge index. |
index refers to an existing edge.
|
inlinenodiscard |
Checks whether a directed edge between two vertices exists.
| source | Source vertex descriptor. |
| target | Target vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If either vertex does not exist. |
|
nodiscard |
Checks that no successor lets a train reverse its direction of travel.
A train passing a vertex comes from one side of it and leaves to the other, e.g., from the toe of a switch to one of its two branches or back. Hence, the neighbors of every vertex must split into two sides such that every successor pair connects a neighbor on one side with a neighbor on the other. A successor turning back onto the reverse edge (U-turn) violates this, and so does one from one branch of a switch to the other (zig-zag) if the switch can also be passed from its toe.
|
inlinenodiscard |
Checks if a TTD can be traversed from a given source to target.
| source_vertex | Source vertex |
| target_vertex | Destination/Target vertex |
| ttd_section | Edges within the TTD section |
|
inlinenodiscard |
Checks if a TTD can be traversed without using a given border vertex.
| border_vertex | Border vertex of the TTD section |
| ttd_section | Edges within the TTD section |
|
inlinenodiscard |
Checks whether a numeric vertex index is valid.
| index | Candidate vertex index. |
index refers to an existing vertex.
|
inlinenodiscard |
Checks whether a vertex with the given name exists.
| name | Vertex name to look up. |
|
inlinestaticnodiscard |
Convenience overload of import_network accepting a C-string path.
| networkName | Name of the network subfolder. |
| workingDirectory | Root working directory as a C-string. |
| cda_rail::exceptions::ImportException | If the network cannot be loaded. |
|
inlinestaticnodiscard |
Loads a network from disk and returns it by value.
| networkName | Name of the network subfolder; defaults to "UnnamedNetwork". |
| working_directory | Root working directory. |
| cda_rail::exceptions::ImportException | If the network cannot be loaded. |
|
inlinestaticnodiscard |
Convenience overload of import_network accepting a std::string path.
| networkName | Name of the network subfolder. |
| working_directory | Root working directory as a string. |
| cda_rail::exceptions::ImportException | If the network cannot be loaded. |
|
inlinenodiscard |
Returns the set of edge indices of all edges entering vertex.
| vertex | Vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
inlinenodiscard |
Checks whether a vertex is adjustable by certain algorithmic approaches.
A vertex is adjustable if and only if it is of type NoBorder and has exactly two neighboring vertices.
| vertex | Vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
nodiscard |
Checks network consistency required for edge-separation transformations.
The following conditions must all hold:
|
inlinenodiscard |
Checks whether two edges belong to the same unbreakable section.
| edge1 | First edge descriptor. |
| edge2 | Second edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If either edge does not exist. |
|
inlinenodiscard |
Checks whether edge_out is a valid successor of edge_in.
A valid successor must satisfy two conditions:
edge_out equals the target of edge_in (adjacency).| edge_in | Predecessor edge. |
| edge_out | Candidate successor edge. |
edge_out is a valid successor of edge_in. | cda_rail::exceptions::EdgeNotExistentException | If either edge does not exist. |
|
nodiscard |
Computes the total length of a path given as an ordered sequence of edge indices.
| path | Ordered vector of edge indices forming the path. |
path, in metres.
|
inlinenodiscard |
Returns the maximum number of VSS borders that can be placed on edge.
Every block has at least the edge's min_block_length, including the blocks towards both ends of the edge, since these end at a border as well. Uniformly separated blocks allow the most borders, hence the value equals floor(length / min_block_length) - 1. Returns 0 for non-breakable edges, when min_block_length is zero, and when the edge is too short for two blocks, in particular when min_block_length exceeds its length.
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inlinenodiscard |
Returns the maximum number of VSS borders that can be placed on edge if their positions are given by sep_func.
As above, every block has at least the edge's min_block_length. A separation function with blocks of different lengths allows fewer borders than a uniform one.
| edge | Edge descriptor. |
| sep_func | Separation function placing the borders. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inlinenodiscard |
Returns the maximum speed achievable at vertex.
If the vertex has exactly one neighbor the speed of the single incident edge is returned. Otherwise the second-highest speed over distinct neighboring vertices is returned, reflecting the maximum speed at which a train can traverse the vertex without reversing.
| vertex | Vertex descriptor. |
| edges_to_consider | Subset of incident edges to consider; if empty, all incident edges are used. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
inlinenodiscard |
Returns the length of the shortest edge incident to vertex.
| vertex | Vertex descriptor. |
| edges_to_consider | Subset of incident edges to consider; if empty, all incident edges are used. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
inlinenodiscard |
Returns the set of edge indices of all edges incident to vertex (both in-edges and out-edges).
| vertex | Vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
inlinenodiscard |
Returns the set of vertex indices adjacent to vertex via any incident edge.
| vertex | Vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
nodiscard |
Returns all sections bounded by NoBorderVSS vertices.
These sections typically result from a prior edge-separation transformation and can be altered by a subsequent VSS-placement algorithm.
|
inlinenodiscard |
Returns the total number of edges in the network.
|
inlinenodiscard |
Returns the total number of vertices in the network.
|
inlinenodiscard |
Returns the set of edge indices of all edges leaving vertex.
| vertex | Vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
|
nodiscard |
Returns the indices of breakable edges, counting each bidirectional track only once.
For a bidirectional breakable track only the edge with the smaller index is included.
|
inline |
Forgets from which edges earlier transformations derived the edges, so that get_old_edge and get_old_path refer to the network as it is now.
|
inlinenodiscard |
Resolves a vertex descriptor to its numeric vertex index.
| vertex | Vertex descriptor. |
| cda_rail::exceptions::VertexNotExistentException | If the vertex does not exist. |
| cda_rail::exceptions::ConsistencyException | If a Vertex object conflicts with the stored vertex data. |
|
inline |
Separates a breakable edge (and its reverse, if present) into multiple sub-edges according to sep_func and the edge's min_block_length.
| edge | Edge descriptor of the edge to separate. |
| sep_func | Separation function that positions the new VSS-border vertices; defaults to uniform separation. |
| cda_rail::exceptions::ConsistencyException | If the network fails is_consistent_for_transformation() or the edge is not breakable. |
| std::vector< std::pair< size_t, cda_rail::index_vector > > cda_rail::Network::separate_edges_at_vss | ( | const std::vector< std::vector< double > > & | vss_positions | ) |
Splits the breakable edges at the given positions, which become VSS border vertices.
Every resulting sub-edge is unbreakable. A reverse edge is split at the same borders, hence, it is enough to specify them for one direction.
| vss_positions | For every edge, the distances of its borders from its source vertex, strictly between 0 and its length. |
| cda_rail::exceptions::ConsistencyException | If the network fails is_consistent_for_transformation(). |
| cda_rail::exceptions::InvalidInputException | If vss_positions does not have one entry per edge. |
|
inline |
Separates a breakable edge using min_stop_block_length with uniform separation.
| edge | Edge descriptor of the edge to separate. |
| cda_rail::exceptions::ConsistencyException | If the network fails is_consistent_for_transformation() or the edge is not breakable. |
| std::vector< std::pair< size_t, cda_rail::index_vector > > cda_rail::Network::separate_stop_edges | ( | const cda_rail::index_set & | stop_edges | ) |
Separates all edges in stop_edges whose length is at least twice their min_stop_block_length.
| stop_edges | Vector of edge indices to process. |
|
inline |
Marks an edge as breakable (VSS borders may be placed on it).
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inline |
Marks an edge as unbreakable (no VSS borders may be placed on it).
| edge | Edge descriptor. |
| cda_rail::exceptions::EdgeNotExistentException | If the edge does not exist. |
|
inline |
Sets the network name.
| networkName | New name; must be a valid directory name on all operating systems. |
| cda_rail::exceptions::InvalidInputException | If networkName is not a valid directory name. |
|
inlinenodiscard |
Returns the shortest path and its length from source_edge to target_edge.
| source_edge | Starting edge descriptor. |
| target_edge | Destination edge descriptor. |
| only_use_valid_successors | If true, only registered successors are followed. |
| edges_to_use | If non-empty, restricts traversable edges. |
| include_first_edge | If true, includes source_edge length. |
| use_minimal_time | If true, measures in travel time. |
| max_v | Maximum train speed in m/s. |
| cda_rail::exceptions::EdgeNotExistentException | If either edge does not exist. |
|
inlinenodiscard |
Returns the shortest path and its length from source_edge to target_vertex.
| source_edge | Starting edge descriptor. |
| target_vertex | Destination vertex descriptor. |
| only_use_valid_successors | If true, only registered successors are followed. |
| edges_to_use | If non-empty, restricts traversable edges. |
| include_first_edge | If true, includes source edge length. |
| use_minimal_time | If true, measures in travel time. |
| max_v | Maximum train speed in m/s. |
| cda_rail::exceptions::EdgeNotExistentException | If the source edge does not exist. |
| cda_rail::exceptions::VertexNotExistentException | If the target vertex does not exist. |
|
inlinenodiscard |
Returns the shortest path and distance from any edge in source_edge_ids to any vertex in target_vertex_ids.
| source_edge_ids | Set of starting edge indices. |
| target_vertex_ids | Set of destination vertex indices. |
| only_use_valid_successors | If true, only registered successors are followed. |
| edges_to_use | If non-empty, restricts traversable edges. |
| include_first_edge | If true, includes source edge length. |
| use_minimal_time | If true, measures in travel time. |
| max_v | Maximum train speed in m/s. |
| cda_rail::exceptions::EdgeNotExistentException | If the source edge does not exist. |
| cda_rail::exceptions::VertexNotExistentException | If the target vertex does not exist. |
|
inlinenodiscard |
Returns the shortest path and distance from any edge in source_edge_ids to any edge in target_edge_ids.
| source_edge_ids | Set of starting edge indices. |
| target_edge_ids | Set of destination edge indices. |
| only_use_valid_successors | If true, only registered successors are followed. |
| edges_to_use | If non-empty, restricts traversable edges. |
| include_first_edge | If true, includes source edge length. |
| use_minimal_time | If true, measures in travel time. |
| max_v | Maximum train speed in m/s. |
| cda_rail::exceptions::EdgeNotExistentException | If either edge does not exist. |
|
inlinenodiscard |
Returns the shortest distance from source_edge to target_edge.
The distance is measured from the target of source_edge to the target of target_edge using only valid successors.
| source_edge | Starting edge descriptor. |
| target_edge | Destination edge descriptor. |
| include_first_edge | If true, the length of source_edge is included in the distance. |
| use_minimal_time | If true, distances are measured in travel time. |
| max_v | Maximum train speed in m/s. |
| cda_rail::exceptions::EdgeNotExistentException | If either edge does not exist. |
|
inlinenodiscard |
Returns the shortest distance from source_edge to target_vertex.
The distance is measured from the target of source_edge to target_vertex using only valid successors.
| source_edge | Starting edge descriptor. |
| target_vertex | Destination vertex descriptor. |
| include_first_edge | If true, the length of source_edge is included. |
| use_minimal_time | If true, distances are measured in travel time. |
| max_v | Maximum train speed in m/s. |
| cda_rail::exceptions::EdgeNotExistentException | If the source edge does not exist. |
| cda_rail::exceptions::VertexNotExistentException | If the target vertex does not exist. |
|
inlinenodiscard |
Returns the length of the shortest path from any edge in source_edge_ids to any vertex in target_vertex_ids.
| source_edge_ids | Set of starting edge indices. |
| target_vertex_ids | Set of destination vertex indices. |
| include_first_edge | If true, includes source edge length. |
| use_minimal_time | If true, measures in travel time. |
| max_v | Maximum train speed in m/s. |
|
inlinenodiscard |
Returns the length of the shortest path from any edge in source_edge_ids to any edge in target_ids.
| source_edge_ids | Set of starting edge indices. |
| target_ids | Set of destination edge indices. |
| include_first_edge | If true, includes source edge length. |
| use_minimal_time | If true, measures in travel time. |
| max_v | Maximum train speed in m/s. |
|
nodiscard |
Returns the shortest distance from any edge in source_edge_ids to every vertex of the network.
Entry [v] is the distance to vertex v, measured as in shortest_path_length_between_edge_and_vertex_set, and INF if v is unreachable. The source vertices themselves are not treated specially: a vertex only gets a finite value if it is the target of some reachable edge.
| source_edge_ids | Set of starting edge indices. |
| include_first_edge | If true, includes source edge lengths. |
| use_minimal_time | If true, measures in travel time. |
| max_v | Maximum train speed in m/s. |
| cda_rail::exceptions::InvalidInputException | If source_edge_ids is empty or use_minimal_time is true with non-positive max_v. |
| cda_rail::exceptions::EdgeNotExistentException | If a source edge does not exist. |
|
inline |
Checks that edge_out may be used directly after edge_in.
| edge_in | Edge descriptor of the incoming edge. |
| edge_out | Edge descriptor of the outgoing edge. |
| cda_rail::exceptions::InvalidInputException | If edge_out is not a successor of edge_in. |
|
nodiscard |
Returns all unbreakable sections of the network.
Each section is represented as a set of edge indices. The method covers:
|
nodiscard |
Returns all vertex indices that are endpoints of at least one edge in edges_tmp.
| edges_tmp | Set of edge indices to inspect. |
edges_tmp.