Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
shortest_path_common.H File Reference

Common utilities and base class for shortest path algorithms. More...

#include <ah-graph-concepts.H>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <type_traits>
#include <ah-errors.H>
#include <tpl_graph.H>
#include <tpl_find_path.H>
#include <tpl_dynListQueue.H>
#include <tpl_dynSetTree.H>
#include <cookie_guard.H>
Include dependency graph for shortest_path_common.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::shortest_path_detail::Beyond_Max_Error
 The std::overflow_error of a painting that leaves out a node whose distance does not fit. More...
 
class  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >
 Base class providing common infrastructure for shortest path algorithms. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Arc_Info
 Information stored in arc cookies for painting version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Tree_Arc_Info
 Extended arc info with tree arc mapping. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Node_Info
 Information stored in node cookies for painting version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Tree_Node_Info
 Extended node info with tree node mapping. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Heap_Info
 Functor to access heap node handle from node cookie. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Get_Potential_Arc
 Functor to get arc potential for heap ordering. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Node
 Node initialization for painting version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Arc
 Arc initialization for painting version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Tree_Node
 Node initialization for tree-building version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Tree_Arc
 Arc initialization for tree-building version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Node
 Node cleanup for painting version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Arc
 Arc cleanup for painting version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Tree_Node
 Node cleanup and mapping for tree-building version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Tree_Arc
 Arc cleanup and mapping for tree-building version. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Total
 Distance totalizer class for path copying. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Painted_Arc
 Arc filter that shows the arcs of the painted tree. More...
 
struct  Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Painted_Node
 Node filter that shows the nodes of the painted tree. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::shortest_path_detail
 Namespace for shortest path algorithm implementation details.
 

Macros

#define SP_NODE_INFO(p)   (static_cast<typename Shortest_Path_Base::Node_Info*>(NODE_COOKIE(p)))
 Convert node cookie to Node_Info pointer.
 
#define SP_TREE_NODE_INFO(p)   (static_cast<typename Shortest_Path_Base::Tree_Node_Info*>(NODE_COOKIE(p)))
 Convert node cookie to Tree_Node_Info pointer.
 
#define SP_ACC(p)   (SP_NODE_INFO(p)->dist)
 Access accumulated distance from node cookie.
 
#define SP_HEAPNODE(p)   (SP_NODE_INFO(p)->heap_node)
 Access heap node handle from node cookie.
 
#define SP_PARENT(p)   (SP_NODE_INFO(p)->ret_node)
 Access parent pointer from node cookie.
 
#define SP_TREENODE(p)   (SP_TREE_NODE_INFO(p)->tree_node)
 Access tree node mapping from node cookie.
 
#define SP_ARC_INFO(p)   (static_cast<typename Shortest_Path_Base::Arc_Info*>(ARC_COOKIE(p)))
 Convert arc cookie to Arc_Info pointer.
 
#define SP_TREE_ARC_INFO(p)   (static_cast<typename Shortest_Path_Base::Tree_Arc_Info*>(ARC_COOKIE(p)))
 Convert arc cookie to Tree_Arc_Info pointer.
 
#define SP_POT(p)   (SP_ARC_INFO(p)->pot)
 Access arc potential from arc cookie.
 
#define SP_TREEARC(p)   (SP_TREE_ARC_INFO(p)->tree_arc)
 Access tree arc mapping from arc cookie.
 

Functions

template<typename T >
T Aleph::shortest_path_detail::checked_add (const T &a, const T &b)
 Safely add two distance values with overflow checking.
 
template<typename T >
bool Aleph::shortest_path_detail::add_if_fits (const T &a, const T &b, T &out)
 Adds two distance values when the sum fits.
 

Detailed Description

Common utilities and base class for shortest path algorithms.

This file contains shared functionality used by Dijkstra's algorithm, A*, and other shortest path algorithms. It provides:

  • Overflow-checked arithmetic operations
  • Common cookie structures for node/arc information
  • Initialize/Destroy functors for cookie management
  • Base class with common algorithm infrastructure
Author
Leandro Rabindranath León

Definition in file shortest_path_common.H.

Macro Definition Documentation

◆ SP_ACC

#define SP_ACC (   p)    (SP_NODE_INFO(p)->dist)

Access accumulated distance from node cookie.

Definition at line 80 of file shortest_path_common.H.

◆ SP_ARC_INFO

#define SP_ARC_INFO (   p)    (static_cast<typename Shortest_Path_Base::Arc_Info*>(ARC_COOKIE(p)))

Convert arc cookie to Arc_Info pointer.

Definition at line 92 of file shortest_path_common.H.

◆ SP_HEAPNODE

#define SP_HEAPNODE (   p)    (SP_NODE_INFO(p)->heap_node)

Access heap node handle from node cookie.

Definition at line 83 of file shortest_path_common.H.

◆ SP_NODE_INFO

#define SP_NODE_INFO (   p)    (static_cast<typename Shortest_Path_Base::Node_Info*>(NODE_COOKIE(p)))

Convert node cookie to Node_Info pointer.

Definition at line 74 of file shortest_path_common.H.

◆ SP_PARENT

#define SP_PARENT (   p)    (SP_NODE_INFO(p)->ret_node)

Access parent pointer from node cookie.

Definition at line 86 of file shortest_path_common.H.

◆ SP_POT

#define SP_POT (   p)    (SP_ARC_INFO(p)->pot)

Access arc potential from arc cookie.

Definition at line 98 of file shortest_path_common.H.

◆ SP_TREE_ARC_INFO

#define SP_TREE_ARC_INFO (   p)    (static_cast<typename Shortest_Path_Base::Tree_Arc_Info*>(ARC_COOKIE(p)))

Convert arc cookie to Tree_Arc_Info pointer.

Definition at line 95 of file shortest_path_common.H.

◆ SP_TREE_NODE_INFO

#define SP_TREE_NODE_INFO (   p)    (static_cast<typename Shortest_Path_Base::Tree_Node_Info*>(NODE_COOKIE(p)))

Convert node cookie to Tree_Node_Info pointer.

Definition at line 77 of file shortest_path_common.H.

◆ SP_TREEARC

#define SP_TREEARC (   p)    (SP_TREE_ARC_INFO(p)->tree_arc)

Access tree arc mapping from arc cookie.

Definition at line 101 of file shortest_path_common.H.

◆ SP_TREENODE

#define SP_TREENODE (   p)    (SP_TREE_NODE_INFO(p)->tree_node)

Access tree node mapping from node cookie.

Definition at line 89 of file shortest_path_common.H.