I have tried pgRouting
in PostGres
for finding shortest path
select d.*, bs.starttime, bs.endtime, bs.trip_id from pgr_dijkstra(
'select id, source, target, traveltime as cost from my_table',
19,
21,
directed := true
) d JOIN my_table bs on d.edge = bs.id;
The above doesn't consider time
as parameter. Before selecting the next edge
, I want to check the time of the transport as well.
Eg:
A ---- > B (03.00PM) (travel time 5)
B ---- > C (3.30PM) (travel time 15)
B ---- > C (11:00AM) (travel time 10)
Current algorithm consider the path with travel time 10 (Without considering the time).
Is there a standard solution for this. I have seen lot of implementations like A* algorithm
. I'm talking about half million
edges.
Or is there any way to get a hook on previous node or next node while computing pgr algorithms ?