Example: Dijkstra optimal path search in graphs

1. Description

This example demonstrates how to use MRPT's C++ implementation of the Dijkstra algorithm for searching optimal paths in a directed, weighted graph. See also the Doxygen reference for the class mrpt::graphs::CDijkstra.

 

2. Example output

 

3. Code

The part that invokes the Dijsktra algorithm is this constructor call:

const size_t SOURCE_NODE = 0;
CDijkstra myDijkstra( 
  graph_links, 
  SOURCE_NODE, 
  myDijkstraWeight); 

See the complete source code of the example for more details: http://mrpt.googlecode.com/svn/trunk/samples/dijkstra-example/

 

 

Syndicate content

The Mobile Robot Programming Toolkit (MRPT) initiative (C) 2012