@@ -509,24 +509,25 @@ public int getNumNodes() {
509
509
queryGraph .lookup (Collections .singletonList (qr ));
510
510
511
511
// we make sure our weight fine tunings do what they are supposed to
512
- double weight03 = getWeight (queryGraph , fastestWeighting , 0 , 3 );
513
- double scWeight23 = weight03 + ((CHEdgeIteratorState ) getEdge (lg , 2 , 3 )).getWeight ();
514
- double scWeight34 = weight03 + ((CHEdgeIteratorState ) getEdge (lg , 3 , 4 )).getWeight ();
515
- double sptWeight2 = weight03 + getWeight (queryGraph , fastestWeighting , 3 , 8 ) + getWeight (queryGraph , fastestWeighting , 8 , 1 ) + getWeight (queryGraph , fastestWeighting , 1 , 2 );
516
- double sptWeight4 = sptWeight2 + getWeight (queryGraph , fastestWeighting , 2 , 4 );
512
+ double weight03 = getWeight (queryGraph , fastestWeighting , 0 , 3 , false );
513
+ double scWeight23 = weight03 + ((CHEdgeIteratorState ) getEdge (lg , 2 , 3 , true )).getWeight ();
514
+ double scWeight34 = weight03 + ((CHEdgeIteratorState ) getEdge (lg , 3 , 4 , false )).getWeight ();
515
+ double sptWeight2 = weight03 + getWeight (queryGraph , fastestWeighting , 3 , 8 , false ) + getWeight (queryGraph , fastestWeighting , 8 , 1 , false ) + getWeight (queryGraph , fastestWeighting , 1 , 2 , false );
516
+ double sptWeight4 = sptWeight2 + getWeight (queryGraph , fastestWeighting , 2 , 4 , false );
517
517
assertTrue ("incoming shortcut weight 3->2 should be smaller than sptWeight at node 2 to make sure 2 gets stalled" , scWeight23 < sptWeight2 );
518
518
assertTrue ("sptWeight at node 4 should be smaller than shortcut weight 3->4 to make sure node 4 gets stalled" , sptWeight4 < scWeight34 );
519
519
520
520
Path path = pch .createAlgo (queryGraph , AlgorithmOptions .start ().build ()).calcPath (0 , 7 );
521
521
assertEquals ("wrong or no path found" , IntArrayList .from (0 , 3 , 8 , 1 , 2 , 4 , 5 , 6 , 7 ), path .calcNodes ());
522
522
}
523
523
524
- private double getWeight (Graph graph , Weighting w , int from , int to ) {
525
- return w .calcWeight (getEdge (graph , from , to ) , false , -1 );
524
+ private double getWeight (Graph graph , Weighting w , int from , int to , boolean incoming ) {
525
+ return w .calcWeight (getEdge (graph , from , to , false ), incoming , -1 );
526
526
}
527
527
528
- private EdgeIteratorState getEdge (Graph graph , int from , int to ) {
529
- EdgeIterator iter = graph .createEdgeExplorer ().setBaseNode (from );
528
+ private EdgeIteratorState getEdge (Graph graph , int from , int to , boolean incoming ) {
529
+ EdgeFilter filter = incoming ? DefaultEdgeFilter .inEdges (carEncoder ) : DefaultEdgeFilter .outEdges (carEncoder );
530
+ EdgeIterator iter = graph .createEdgeExplorer (filter ).setBaseNode (from );
530
531
while (iter .next ()) {
531
532
if (iter .getAdjNode () == to ) {
532
533
return iter ;
0 commit comments