Tracore
Public Member Functions | List of all members
algo::KShortestPaths Class Reference

#include <KShortestPaths.h>

Public Member Functions

 KShortestPaths (DirectedGraph input_graph, Vertex source, Vertex sink)
 
void Run (size_t max_path_count)
 
void GetPaths (std::vector< std::vector< Vertex >> &paths)
 

Detailed Description

Finds the k-shortest paths in a specified graph, from the source vertex to the sink vertex. The algorithm provides a global optimal path, thus reducing the overall sum of all path costs in trade off for higher cost of one single path.

Constructor & Destructor Documentation

algo::KShortestPaths::KShortestPaths ( DirectedGraph  input_graph,
Vertex  source,
Vertex  sink 
)

Initializes the algorithm for the specified graph with the specified source and sink vertex to find a path between.

Parameters
input_graphThe graph to work with (will not be altered)
sourceThe vertex to start all path searches from
sinkThe vertex to end all path searches at

Member Function Documentation

void algo::KShortestPaths::GetPaths ( std::vector< std::vector< Vertex >> &  paths)

Gets the last found paths.

Parameters
pathsThe vector to store all found paths in
void algo::KShortestPaths::Run ( size_t  max_path_count)

Runs the algorithm to store the specified number of paths. These paths can later be retrieved by the GetPaths method.

Parameters
max_path_countThe number of paths to find

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