pgRouting Manual (2.3)

Developer’s Guide

«  Handling parallels after getting a path (pgr_ksp focus)   ::   Contents   ::   Sample Data  »

Developer’s Guide

This contains some basic comments about developing. More detailed information can be found on:

Source Tree Layout

cmake scripts used as part of our build system.
This is the algorithm source tree. Each algorithm is to be contained in its on sub-tree with /doc, /sql, /src, and /test sub-directories.

For example:

  • src/dijkstra Main direcotry for dijkstra algorithm.
  • src/dijkstra/doc Dijkstra’s documentation directory.
  • src/dijkstra/src Dijkstra’s C and/or C++ code.
  • src/dijkstra/sql Dijkstra’s sql code.
  • src/dijkstra/test Dijkstra’s tests.
  • src/dijkstra/test/pgtap Dijkstra’s pgTaptests.


Miscellaneous scripts and tools.


To keep version/branch/commit up to date install pelase do the following:

cp tools/pre-commit .git/hooks/pre-commit

After each commit a the file VERSION will remain. (The hash number will be one behind)


To use doxygen:

cd tools/doxygen/

The code’s documentation can be found in:



We try to follow the following guidelines for C++ coding:

Sample use:

python ../src/dijkstra/src/dijkstra_driver.h
../src/dijkstra/src/dijkstra_driver.h:34:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
../src/dijkstra/src/dijkstra_driver.h:40:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
Done processing ../src/dijkstra/src/dijkstra_driver.h
Total errors found: 2
  • Maybe line 34 is a very complicated calculation so you can just ignore the message
  • Delete whitespace at end of line is easy fix.
  • Use your judgement!!!

Some files like postgres.h are system dependent so don’t include the directory.

Other tools

Tools like:
  • doit
  • winnie

are very specific for the deployment of new versions, so please ask first!

Documentation Layout


All documentation should be in reStructuredText format. See: <> for introductory docs.

Documentation is distributed into the source tree. This top level “doc” directory is intended for high level documentation cover subjects like:

  • Compiling and testing
  • Installation
  • Tutorials
  • Users’ Guide front materials
  • Reference Manual front materials
  • etc

Since the algorithm specific documentation is contained in the source tree with the algorithm specific files, the process of building the documentation and publishing it will need to assemble the details with the front material as needed.

Also, to keep the “doc” directory from getting cluttered, each major book like those listed above, should be contained in a separate directory under “doc”. Any images or other materials related to the book should also be kept in that directory.

Testing Infrastructure

Tests are part of the tree layout:

  • src/dijkstra/test Dijkstra’s tests.
    • test.conf Configuration file.
    • <name>.test.sql Test file
    • <name>.result Results file bash
  • src/dijkstra/test/pgtap Dijkstra’s pgTaptests.
    • <name>.sql pgTap test file


Testing is executed from the top level of the tree layout:

createdb  -U <user> ___pgr___test___
sh ./tools/testers/ <user>
dropdb  -U <user> ___pgr___test___

Indices and tables

«  Handling parallels after getting a path (pgr_ksp focus)   ::   Contents   ::   Sample Data  »