DHART
Loading...
Searching...
No Matches
HF::Pathfinding::DistPred Struct Reference

A single row of a distance and predecessor matrix. More...

+ Collaboration diagram for HF::Pathfinding::DistPred:

Public Member Functions

 DistPred ()
 Construct a new instance of DistPred with empty distance and predecessor arrays. More...
 
 DistPred (int n)
 Allocate enough space for n elements. More...
 

Public Attributes

std::vector< float > distance
 Distance array. More...
 
std::vector< vertex_descriptorpredecessor
 Predecessor array. More...
 

Detailed Description

A single row of a distance and predecessor matrix.

DistPred holds the distance and predecessor arrays for a single node, all the information needed to generate a path for the node it was generated from.

Remarks
This struct can be useful for keeping the multiple distance and predecessor arrays organized when preallocating them, as well as reducing the amount of code required to generate a path.
See also
ConstructShortestPathFromPred for an example of using these arrays to find the shortest path between two nodes.

Definition at line 48 of file path_finder.cpp.

Constructor & Destructor Documentation

◆ DistPred() [1/2]

HF::Pathfinding::DistPred::DistPred ( )
inline

Construct a new instance of DistPred with empty distance and predecessor arrays.

Definition at line 55 of file path_finder.cpp.

◆ DistPred() [2/2]

HF::Pathfinding::DistPred::DistPred ( int  n)
inline

Allocate enough space for n elements.

Parameters
nSize to allocate for both the distance and predecessor arrays.
Remarks
This is useful for calling boost's dijkstra methods since they expect the arrays to already be the correct size.

Definition at line 61 of file path_finder.cpp.

References distance, and predecessor.

Member Data Documentation

◆ distance

std::vector<float> HF::Pathfinding::DistPred::distance

◆ predecessor

std::vector<vertex_descriptor> HF::Pathfinding::DistPred::predecessor

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