Hi all,
I have started looking at the function signatures with an eye toward clean them up and making them easier to deal with.
A little history. When we write code for a function in pgRouting there are typically a few functions that are very simple and map to the low-level C code fairly closely. Than on top of that people have written convenience functions to hide some of the complexity of the various ways to optimize the queries based on things like bounding boxes, or a buffer distance to create a bounding box. Then there are things like adding information about whether your graph is directed or not, and to specify a cost column name or a reverse cost column name, etc.
So if you look at the attached spreadsheet, you can see some of this mess.
I plan is to clean this up! I have not decided how deeply to cut into this mess. I'm inclined to put the old functions into a pgrouting_legacy.sql file that gets installed but not loaded into the database by default. People that don't or can't upgrade their code to use the new function names would be able to load this file at least for the 2.0 release, but this might go away in the future.
My goal is to try and map most of the various shortest path functions to a template something like:
func_name(
table_name, -- table or view name
start_id, -- edge or vertix id, for trsp this could be [id, pos,]
target_id, -- edge or vertix id, for trsp this could be [id, pos,]
delta, -- *amount to expand an implied bbox
directed, -- *is the graph directed?
has_rcost) -- *does the table have reverse_cost column?
* these items would be optional
In the spreadsheet under the library column, the blanks represent wrapper function, the lib* entries are the low level SQL wrappers to the C code and legacy stuff I threw into the what will become the legacy file.
Thoughts and feedback are welcome.
-Steve
pgRouting 2.0 Functions.pdf (186 KB)