Official Coding Period: Week 3 (June 16 – June 22)
This time, at the start of the week as usual while discussing with my mentors I realised that I have been actually trying to implement the wrong algorithm! TT
Well…not really but let me explain:
So, according to my original plan I was supposed to have custom starting and ending vertices along with edges_sql
as my input parameters but that is not under the official boost sloan ordering algorithm.
There are actually two sub algorithms of sloan:
- sloan_ordering &
- sloan_start_end_vertices
According to my proposal, I should have implemented the first one but I had written the code for the second one, the difference isn’t major. Instead of mathematically finding optimal starting and ending vertices, it will simply fetch for me the best vertices required with the help of another sub-algorithm called sloan_starting_node
and will perform the actual vertex reordering and can be done with the help of the later function.
With sloan_start_end_vertices
:
pgr_sloanOrdering(
TEXT, -- edges_sql (required)
BIGINT, --start_vid
BIGINT, --end_vid
OUT seq BIGINT,
OUT node BIGINT)
RETURNS SETOF RECORD;
With sloan_ordering
simply:
pgr_sloanOrdering(
TEXT, -- edges_sql (required)
OUT seq BIGINT,
OUT node BIGINT)
RETURNS SETOF RECORD;
With these new changes in parameters and data types, I had to modify my other code too and fix the subsequent compilation errors. So this week I fixed my code to suit the official boost implementation better.