Implement heading and pass_through for CH
For edge-based CH this is not a problem, but even for node-based CH it is possible, at least in theory. I'm just not sure if it is worth the effort.
The problem with node-based CH is described here: https://github.com/graphhopper/graphhopper/commit/e8cdc6fb0afa8810fb4074aafee13fc2c0eb46e3
I think an easy way to do it with node-based CH would be this:
- find adjacent nodes next to start node (A, B, C)
- calculate all routes A,B,C -> target node with an initial weight for A,B,C (zero for the heading direction and including a penalty otherwise)
- reject all routes that visit the start node (A->start->target) for example
- pick the shortest remaining route
- prepend the start node to this shortest route
Slightly more complicated, but more efficient would be:
- see above
- do a multi source query (A,B,C)->target with initial weights, but also use an edge filter that filters out edges going to the start node for the first expansion. this requires unpacking shortcuts for the first expansion!
- prepend the start node to the resulting route
pass_through should work the same way.
So the question is kind of this: If we support heading/pass-through for edge-based CH (which I think would be very nice to have) we should remove this 'unfavored edge' stuff in QueryGraph (just because we should not do things in too many different ways). But once we do that there won't be support for heading for node-based algorithms anymore, unless we properly implement this as well. And if we implement this for node-based algorithms it would be also logical to do it for CH too?
But either way we should keep in mind that node-based and edge-based heading are not the same, because edge-based heading might produce routes with an initial p-turn like this:
// heading = East
target
|
start - a
| |
c --- b
and node-based will not.
One could argue that the node-based algorithm is limited for high quality routes in general (i.e. without turn restriction support) to give high performance and so it would make sense when other features like this are not supported too, especially since this is a lot effort.