You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Backward-only loops make problems with edge-based routing. #1525
When we add a loop edge that only has the bwd but not the fwd bit set we are getting problems with edge-based routing. The loop edge will not be found by forward searches (using DefaultEdgeFilter.outEdges) so if there is a path that requires a loop (e.g. because of a restricted direct turn at the loop node) it will not be found or another (a sub-optimal) route will be found. With a bidirectional algorithm we would discover the loop in the backward search, but right now there will be a runtime exception in AbstractWeighting. Also the forward search would have to 'wait' at the loop for the backward search which can harm performance. Its probably questionable if a bwd-only loop is ever a real problem, but it is possible in principle. I think the current import does not produce it. It would be needed if we wanted to get the reverse geometry of a loop.
See tests here: https://gist.github.com/easbar/06e7a9c71888fe147887e1d83dde9fe1
or better here: e484314
Also see discussion in #1247.
This will fail even more likely with the Isochrone API if we use the adapted DefaultEdgeFilter #1247 (it is currently the remaining problem before we can merge it):
! java.lang.IllegalStateException: Calculating time should not require to read speed from edge in wrong direction. Reverse:true, fwd:true, bwd:false
! at com.graphhopper.routing.weighting.AbstractWeighting.calcMillis(AbstractWeighting.java:46)
! at com.graphhopper.routing.weighting.FastestWeighting.calcMillis(FastestWeighting.java:83)
! at com.graphhopper.isochrone.algorithm.Isochrone.searchInternal(Isochrone.java:203)
! at com.graphhopper.isochrone.algorithm.Isochrone.searchGPS(Isochrone.java:107)
! at com.graphhopper.resources.IsochroneResource.doGet(IsochroneResource.java:95)
....
So either we reject such loops for the isochrone or we better fix this that the edge returns the one-way loop in the correct direction where we do not attempt to read the speed in the wrong direction.
The best thing would be if such loops would be returned as two edge states: one edge state in forward direction and one in backward direction. This would be similar to a small example graph A->B-C-A with the one-way A->B: accessing the edge A-B from A returns A->B and accessing it from B we return a different B<-A.
But it is unclear how to fetch the two different edge states with an edgeId and a nodeId. The solution here could be to use the edge key: graph.getEdgeIteratorState(edgeKey). Probably we have to deprecate getEdgeIteratorState(edge,adjNode) as this is meant to return the unique edge state but fails in those cases.
This would be probably the cleanest solution and IMO would also avoid this special handling in the DefaultEdgeFilter. But it might collide with the current way (in GTFS) of how we attach data to nodes: via loops.
The simplest solution is likely to convert one pillar node into a tower node for such loops with the downside that every data import needs a special handling for one-way loops. Should we do this for now and merge #1247 and keep this here open?
I think the current import does not produce it.
Currently it can produce it because we potentially reverse flags before storing the flags. This will change with #1447 where we return the flags always how they are stored and do not artificially reverse them
Activity
karussell commentedon Jan 21, 2019
This will fail even more likely with the Isochrone API if we use the adapted DefaultEdgeFilter #1247 (it is currently the remaining problem before we can merge it):
Resulting in:
So either we reject such loops for the isochrone or we better fix this that the edge returns the one-way loop in the correct direction where we do not attempt to read the speed in the wrong direction.
karussell commentedon Jan 21, 2019
The best thing would be if such loops would be returned as two edge states: one edge state in forward direction and one in backward direction. This would be similar to a small example graph
A->B-C-Awith the one-wayA->B: accessing the edgeA-Bfrom A returnsA->Band accessing it fromBwe return a differentB<-A.But it is unclear how to fetch the two different edge states with an edgeId and a nodeId. The solution here could be to use the edge key:
graph.getEdgeIteratorState(edgeKey). Probably we have to deprecate getEdgeIteratorState(edge,adjNode) as this is meant to return the unique edge state but fails in those cases.This would be probably the cleanest solution and IMO would also avoid this special handling in the DefaultEdgeFilter. But it might collide with the current way (in GTFS) of how we attach data to nodes: via loops.
The simplest solution is likely to convert one pillar node into a tower node for such loops with the downside that every data import needs a special handling for one-way loops. Should we do this for now and merge #1247 and keep this here open?
Currently it can produce it because we potentially reverse flags before storing the flags. This will change with #1447 where we return the flags always how they are stored and do not artificially reverse them
trying to fix #1525
fix bug in tower node injection if loop-edge; handle landmark bug in …
trying to fix #1525
fix bug in tower node injection if loop-edge; handle landmark bug in …
Do not create loop-edges (#1531)