|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
K-shortest path algorithms (Yen and Eppstein-style API). More...
#include <ah-graph-concepts.H>#include <cmath>#include <cstddef>#include <limits>#include <type_traits>#include <utility>#include <Dijkstra.H>#include <ah-errors.H>#include <cookie_guard.H>#include <shortest_path_common.H>#include <htlist.H>#include <tpl_array.H>#include <tpl_dynListQueue.H>#include <tpl_dynMapTree.H>#include <tpl_dynSetTree.H>Go to the source code of this file.
Classes | |
| struct | Aleph::K_Shortest_Path_Item< GT, Cost_Type > |
| A shortest-path item returned by k-shortest algorithms. More... | |
| struct | Aleph::k_shortest_paths_detail::Path_State< GT, Cost_Type > |
| struct | Aleph::k_shortest_paths_detail::Suffix_Index< GT, Cost_Type > |
| class | Aleph::k_shortest_paths_detail::Painting_Within_Max< GT, Distance, Itor, SA > |
| A painting of Dijkstra that leaves out the nodes whose distances do not fit, as nodes that the start does not reach, instead of throwing. More... | |
| struct | Aleph::k_shortest_paths_detail::Filtered_Show_Arc< GT, SA > |
| struct | Aleph::k_shortest_paths_detail::Reverse_Arc_Distance< GT, Distance > |
| struct | Aleph::k_shortest_paths_detail::Path_Snapshot< GT, Cost_Type > |
| class | Aleph::Yen_K_Shortest_Paths< GT, Distance, SA > |
| Functor wrapper for Yen's k-shortest loopless paths algorithm. More... | |
| class | Aleph::Eppstein_K_Shortest_Paths< GT, Distance, SA > |
| Functor wrapper for Eppstein-style k-shortest paths API. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::k_shortest_paths_detail |
Functions | |
| template<template< typename, class > class Itor, AlephGraph GT, ArcFilter< GT > SA, class Op > | |
| void | Aleph::k_shortest_paths_detail::for_each_left_out (typename GT::Node *start, SA sa, Op op) |
| Calls op on each node that start reaches through the arcs that sa shows, but that a painting from start did not reach: those whose distances from it do not fit. | |
| template<AlephGraph GT, ArcDistance< GT > Distance, ArcFilter< GT > SA> requires std::is_arithmetic_v<typename Distance::Distance_Type> | |
| void | Aleph::k_shortest_paths_detail::validate_non_negative_weights (const GT &g, Distance distance, SA sa) |
| template<AlephGraph GT, typename Cost_Type > | |
| Path_Snapshot< GT, Cost_Type > | Aleph::k_shortest_paths_detail::make_path_snapshot (const Path_State< GT, Cost_Type > &path) |
| template<AlephGraph GT, typename Cost_Type > | |
| Path_State< GT, Cost_Type > | Aleph::k_shortest_paths_detail::path_to_state (const Path< GT > &path, const Cost_Type total_cost) |
| template<AlephGraph GT, typename Cost_Type > | |
| Path< GT > | Aleph::k_shortest_paths_detail::state_to_path (const GT &g, const Path_State< GT, Cost_Type > &state) |
| template<AlephGraph GT, typename Cost_Type > | |
| bool | Aleph::k_shortest_paths_detail::same_path_sequence (const Path_State< GT, Cost_Type > &a, const Path_State< GT, Cost_Type > &b) |
| template<AlephGraph GT, typename Cost_Type > | |
| bool | Aleph::k_shortest_paths_detail::same_prefix_nodes (const Path_Snapshot< GT, Cost_Type > &a, const Path_Snapshot< GT, Cost_Type > &b, const size_t spur_index) |
| template<AlephGraph GT, typename Cost_Type > | |
| bool | Aleph::k_shortest_paths_detail::contains_path (const Array< Path_State< GT, Cost_Type > > &container, const Path_State< GT, Cost_Type > &candidate) |
| template<AlephGraph GT, typename Cost_Type > | |
| GT::Node * | Aleph::k_shortest_paths_detail::get_tree_next (const Suffix_Index< GT, Cost_Type > &index, typename GT::Node *node) |
| template<AlephGraph GT, typename Cost_Type > | |
| GT::Arc * | Aleph::k_shortest_paths_detail::get_tree_arc (const Suffix_Index< GT, Cost_Type > &index, typename GT::Node *node) |
| template<template< class, class > class Itor, AlephGraph GT, ArcDistance< GT > Distance, ArcFilter< GT > SA> | |
| Suffix_Index< GT, typename Distance::Distance_Type > | Aleph::k_shortest_paths_detail::build_suffix_index_with_itor (const GT &g, typename GT::Node *target, Distance distance, SA sa) |
| template<AlephGraph GT, ArcDistance< GT > Distance, ArcFilter< GT > SA> | |
| Suffix_Index< GT, typename Distance::Distance_Type > | Aleph::k_shortest_paths_detail::build_suffix_index_digraph (const GT &g, typename GT::Node *target, Distance distance, SA sa) |
| template<AlephGraph GT, ArcDistance< GT > Distance, ArcFilter< GT > SA> | |
| Suffix_Index< GT, typename Distance::Distance_Type > | Aleph::k_shortest_paths_detail::build_suffix_index (const GT &g, typename GT::Node *target, Distance distance, SA sa) |
| template<AlephGraph GT, typename Cost_Type > | |
| bool | Aleph::k_shortest_paths_detail::build_suffix_state (const GT &g, const Suffix_Index< GT, Cost_Type > &index, typename GT::Node *start, typename GT::Node *target, Path_State< GT, Cost_Type > &out_suffix) |
| template<AlephGraph GT, ArcDistance< GT > Distance, ArcFilter< GT > SA> | |
| bool | Aleph::k_shortest_paths_detail::shortest_path_filtered (const GT &g, typename GT::Node *source, typename GT::Node *target, Distance distance, SA sa, const DynSetTree< typename GT::Node * > *forbidden_nodes, const DynSetTree< typename GT::Arc * > *forbidden_arcs, Path_State< GT, typename Distance::Distance_Type > &out, bool &beyond) |
| template<AlephGraph GT, ArcDistance< GT > Distance> | |
| bool | Aleph::k_shortest_paths_detail::cost_of_arcs_if_fits (const DynList< typename GT::Arc * > &arcs, Distance distance, typename Distance::Distance_Type &total) |
| template<AlephGraph GT, typename Cost_Type > | |
| Path_State< GT, Cost_Type > | Aleph::k_shortest_paths_detail::compose_candidate (const Path_Snapshot< GT, Cost_Type > &base_path, const size_t spur_index, const Path_State< GT, Cost_Type > &spur_state) |
| template<AlephGraph GT, typename Cost_Type > | |
| Path_State< GT, Cost_Type > | Aleph::k_shortest_paths_detail::compose_general_candidate (const Path_Snapshot< GT, Cost_Type > &base_path, const size_t spur_index, typename GT::Arc *deviation_arc, typename GT::Node *deviation_next_node, const Path_State< GT, Cost_Type > &suffix_state) |
| template<AlephGraph GT, ArcDistance< GT > Distance, ArcFilter< GT > SA, typename Cost_Type > | |
| void | Aleph::k_shortest_paths_detail::generate_general_deviation_candidates (const GT &g, const Path_State< GT, Cost_Type > &base_path, typename GT::Node *target, const Suffix_Index< GT, Cost_Type > &suffix_index, Distance distance, SA sa, const Array< Path_State< GT, Cost_Type > > &accepted, Array< Path_State< GT, Cost_Type > > &candidates, bool &beyond) |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> requires std::is_arithmetic_v<typename Distance::Distance_Type> | |
| DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > | Aleph::yen_k_shortest_paths (const GT &g, typename GT::Node *source, typename GT::Node *target, const size_t k, Distance distance=Distance(), SA sa=SA()) |
| Compute k shortest loopless paths using Yen's algorithm. | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> requires std::is_arithmetic_v<typename Distance::Distance_Type> | |
| DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > | Aleph::eppstein_k_shortest_paths (const GT &g, typename GT::Node *source, typename GT::Node *target, const size_t k, Distance distance=Distance(), SA sa=SA()) |
| Compute k shortest general (loopy) paths. | |
K-shortest path algorithms (Yen and Eppstein-style API).
This header provides two k-shortest path modes over Aleph graphs.
yen_k_shortest_paths(...): Yen's algorithm for loopless paths.eppstein_k_shortest_paths(...): General (non-loopless) k-shortest API based on deviation expansion over shortest suffixes.| Algorithm | Time | Space |
|---|---|---|
| Yen | O(k * V * (E + V log V)) | O(k * V + E) |
| Eppstein-style | O(E log V + k log k) | O(E log V + k) |
Definition in file K_Shortest_Paths.H.