Path calcPath(GraphHopperStorage ghStorage, int fromNode1, int fromNode2, int toNode1, int toNode2) { // lookup two edges: fromNode1-fromNode2 and toNode1-toNode2 QueryResult from = newQR(ghStorage, fromNode1, fromNode2); QueryResult to = newQR(ghStorage, toNode1, toNode2); RoutingAlgorithmFactory factory = createFactory(ghStorage, defaultOpts); QueryGraph qGraph = new QueryGraph(getGraph(ghStorage, defaultOpts.getWeighting())).lookup(from, to); return factory.createAlgo(qGraph, defaultOpts).calcPath(from.getClosestNode(), to.getClosestNode()); }