Shortest path

Shortest path algorithms are tasked with calculating the shortest path between specified points. pgRouting offers the following to choose from:

  • Shortest path Dijkstra
  • Bi-directional Dijkstra shortest path
  • Shortest path A*
  • Bi-directional A* shortest path
  • K-shortest path, multiple alternative paths
  • K-Dijkstra, One-to-Many Shortest Path
  • Turn restrictions shortest path (TRSP)

Shortest path does not necessarily mean shortest in terms of length. If a network has some other characteristics assigned, for example, time needed to travel an edge, or the cost of travel, the output can be considered the quickest or cheapest respectively. The meaning of the 'cost' provided to the shortest path algorithms can therefore be adjusted to suit even sophisticated needs and calculate routes with the lowest denivelation, for example.

The output of the algorithms is not geometry as one could expect, but rather a dataset that describes the sequence of nodes and edges, along with the cost of traveling through an edge and the cumulative cost of a route. We'll see some examples a bit later.

You may have noticed that both Dijskatra and A* algorithms have bi-directional variants. In such cases, the path is being calculated simultaneously from both ends (source and target) and stopped in between whenever the paths meet. This is meant to improve performance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset