AlgoPlus v0.1.0
Loading...
Searching...
No Matches
AStar< T > Class Template Reference

#include <astar.h>

Public Member Functions

 AStar (std::unordered_map< T, std::vector< std::pair< T, double > > > v={}, std::unordered_map< T, double > nodes={})
 A* constructor.
 
void insert_node (T u, double val)
 insert_node function
 
bool has_edge (T u, T v)
 has_edge function
 
void add_edge (T u, T v, double dist)
 add_edge function
 
std::vector< T > shortest_path (T start, T end)
 shortest_path function
 

Detailed Description

template<typename T>
class AStar< T >

@ brief A* Class

Constructor & Destructor Documentation

◆ AStar()

template<typename T>
AStar< T >::AStar ( std::unordered_map< T, std::vector< std::pair< T, double > > > v = {},
std::unordered_map< T, double > nodes = {} )
inlineexplicit

A* constructor.

Parameters
vunordered_map<T, vector<pair<T, double> > > initializer adjacency list. Default = {}
nodesunordered_map<T, double> contains the heuristic value of each node. Default = {}

Member Function Documentation

◆ add_edge()

template<typename T>
void AStar< T >::add_edge ( T u,
T v,
double dist )
inline

add_edge function

Parameters
uthe first node
vthe second node
distthe distance between u and v

◆ has_edge()

template<typename T>
bool AStar< T >::has_edge ( T u,
T v )
inline

has_edge function

Parameters
uthe first node
vthe second node
Returns
true if there exist an edge between u and v
false otherwise

◆ insert_node()

template<typename T>
void AStar< T >::insert_node ( T u,
double val )
inline

insert_node function

Parameters
uthe node ID @val: the heuristic value of node u

◆ shortest_path()

template<typename T>
std::vector< T > AStar< T >::shortest_path ( T start,
T end )
inline

shortest_path function

Parameters
startstarting node
endend node
Returns
vector<T>: the shortest path from start to end

The documentation for this class was generated from the following file: