### Question:
AlternativeRoute implements RoutingAlgorithm { public List<AlternativeInfo> calcAlternatives(int from, int to) { AlternativeBidirSearch altBidirDijktra = new AlternativeBidirSearch( graph, weighting, traversalMode, maxExplorationFactor * 2); altBidirDijktra.setMaxVisitedNodes(maxVisitedNodes); if (weightApproximator != null) { altBidirDijktra.setApproximation(weightApproximator); } Path bestPath = altBidirDijktra.searchBest(from, to); visitedNodes = altBidirDijktra.getVisitedNodes(); return altBidirDijktra. calcAlternatives(bestPath, maxPaths, maxWeightFactor, 7, maxShareFactor, 0.8, minPlateauFactor, -0.2); } AlternativeRoute(Graph graph, Weighting weighting, TraversalMode traversalMode); void setApproximation(WeightApproximator weightApproximator); @Override void setMaxVisitedNodes(int numberOfNodes); void setMaxWeightFactor(double maxWeightFactor); void setMaxShareFactor(double maxShareFactor); void setMinPlateauFactor(double minPlateauFactor); void setMaxExplorationFactor(double explorationFactor); void setMaxPaths(int maxPaths); List<AlternativeInfo> calcAlternatives(int from, int to); @Override Path calcPath(int from, int to); @Override List<Path> calcPaths(int from, int to); @Override String getName(); @Override int getVisitedNodes();  }### Answer:
@Test public void testCalcAlternatives() { initTestGraph(graph); AlternativeRoute altDijkstra = new AlternativeRoute(graph, weighting, traversalMode); altDijkstra.setMaxShareFactor(0.5); altDijkstra.setMaxWeightFactor(2); List<AlternativeRoute.AlternativeInfo> pathInfos = altDijkstra.calcAlternatives(5, 4); checkAlternatives(pathInfos); assertEquals(2, pathInfos.size()); DijkstraBidirectionRef dijkstra = new DijkstraBidirectionRef(graph, weighting, traversalMode); Path bestPath = dijkstra.calcPath(5, 4); Path bestAlt = pathInfos.get(0).getPath(); Path secondAlt = pathInfos.get(1).getPath(); assertEquals(bestPath.calcNodes(), bestAlt.calcNodes()); assertEquals(bestPath.getWeight(), bestAlt.getWeight(), 1e-3); assertEquals(IntArrayList.from(5, 6, 3, 4), bestAlt.calcNodes()); assertEquals(IntArrayList.from(5, 6, 7, 8, 4), secondAlt.calcNodes()); assertEquals(1667.9, secondAlt.getWeight(), .1); }