[pgrouting-dev] pgRouting Development Environment

I would like to contribute to the pgRouting project, but there is a bit of a barrier for me since I am unfamiliar with C and integrating with PostgreSQL.

Is a good tutorial or starting point for someone who is interested in contributing to the project but may not be familiar with the development environment required for pgRouting?

Looking for:

  1. What tools/Operating system is required.
  2. How to test existing code and new code that I might write.
  3. How to debug existing and new code.

Thanks!

Hi Steve,

Wow, the uptick in pgRouting traffic and interest is great. I just went through this same issue, but for me I know C and not C++ so well. I wrote the integration of the TRSP C++ code that was written by Ashraf Hossain in Bangladesh. I took the Dijkstra C wrapper and modeled the code after that. Look at the TRSP code in extra/trsp/src of the trsp branch in git.

trsp.c - C code the interfaces with postgres, runs the
                        queries, loads data into structs
trsp_core.cpp - trival function to create C++ solver object
GraphDefinition.cpp - C++ trsp solver classes

postgres documentation is here:
http://www.postgresql.org/docs/8.3/static/spi.html
http://www.postgresql.org/docs/8.3/static/spi-examples.html
http://www.postgresql.org/docs/8.3/static/extend.html
http://www.postgresql.org/docs/8.3/static/xfunc-c.html

On 2/3/2012 10:09 AM, Steve Horn wrote:

I would like to contribute to the pgRouting project, but there is a bit
of a barrier for me since I am unfamiliar with C and integrating with
PostgreSQL.

Is a good tutorial or starting point for someone who is interested in
contributing to the project but may not be familiar with the development
environment required for pgRouting?

Looking for:
1) What tools/Operating system is required.

I work on Linux, and typically you need to install packages for compilers, and postgresql development headers.

2) How to test existing code and new code that I might write.

This is an area that we need to work on. We currently do not have a set of tests which has caused the regression problems with shooting star being broken. I have started making some test cases, but I have not figured out how to best define the graphs, inputs, and the output standards to compare against, or how to run a suite of tests. My thought is that we want to create a database with various simple graph files and a table of inputs and results, then we can write a script that runs the tests and reports the results. so that this can be run easily like with "make test"

3) How to debug existing and new code.

I would recommend that when you develop a new algorithm in C++ that you write a main command line test harness that you can use to debug and run unit tests from. The purpose for this is to validate the the core algorithm outside of postgresql works as expected. Then in the C code you can print debug NOTICE statements to see what is happening in the C code inside postgresql. It is also possible to run posgresql as a single user inside gdb and debug it this way, but I have never done that.

If you look at the Dijkstra and my trsp.c code you will see these debug statement and a #define DEBUG 1 which turn them on/off.

I would suggest create your own branch on github where you can keep your code and then create a ticket with a pull request when you are ready for code to be integrated. We can also discuss giving you commit access if you are interested in working on cutting a release.

Thanks!

Thank you for your interest and willingness to get involved. I will help as much as I can. I really want to get the development more organized and more people involved.

Thank you,
   -Steve