CoinShortestPath

Class that implements Dijkstra's algorithm for finding the shortest paths between nodes in a graph.

Class that implements Dijkstra's algorithm for finding the shortest paths between nodes in a graph.

Public Methods

CoinShortestPath

Default constructor.

 CoinShortestPath(size_t nodes, size_t arcs, const size_t * arcStart, const size_t * toNode, const double * dist)

Parameters:

~CoinShortestPath

Destructor.

 ~CoinShortestPath()

find

Execute the shortest path finder using Dijkstra's algorithm.

void find(const size_t origin)

Parameters:

find

Execute the shortest path finder using the Dijkstra algorithm.

void find(const size_t origin, const size_t destination)

Parameters:

path

Fill array indexes with all previous nodes which should be steped to arrive at a given node (this node is not included).

size_t path(size_t toNode, size_t * indexes)

Parameters:

numNodes

Return the number of nodes in the graph.

size_t numNodes()

numArcs

Return the number of arcs in the graph.

size_t numArcs()

distance

Return the length of the shortest path from the origin node (passed in method find) to node.

double distance(size_t node)

Parameters:

previous

Return the previous node of a given node in the shortest path.

size_t previous(size_t node)

Parameters:

previous

Return an array containing the previous nodes which should be steped to arrive at a given node.

const size_t * previous()

Source

Header: layer-0/CoinUtils/src/CoinShortestPath.hpp