You can use findAllPaths with dijkstra too, and then just pull the first 3 paths from the iterator.
Or why do you want to use shortestPath instead? Dijsktra is calculating the shortest path based on your costProperty. Am 21.03.2014 um 17:26 schrieb Antonio Grimaldi <antonio.grimaldim...@gmail.com>: > Hi, > I used the Dijkstra algorithm to compute the path between two nodes in the > graph, in this way : > > > CostEvaluator<Double> costEvaluator = null; > if(costProperty.equalsIgnoreCase(IConstants.EDGE_LENGTH_PROPERTY)){ > > //In questo caso bisogna eseguire il calcolo del percorso più breve (minore > distanza percorsa) > costEvaluator = CommonEvaluators.doubleCostEvaluator( costProperty ); > > }else if(costProperty.equalsIgnoreCase(IConstants.EDGE_SPEED_PROPERTY)){ > > //In questo caso bisogna eseguire il calcolo del percorso più rapido > (minore rapporto distanza/velocità) > costEvaluator = new CostEvaluator<Double>() { > @Override > public Double getCost(Relationship relationship, Direction direction) > { > Double edgeLength = (Double) > relationship.getProperty(IConstants.EDGE_LENGTH_PROPERTY); > Long edgeSpeed = (Long) > relationship.getProperty(IConstants.EDGE_SPEED_PROPERTY); > Double cost = edgeLength / edgeSpeed; > return cost.doubleValue(); > } > }; > } > > PathFinder<WeightedPath> dijkstraPath = > GraphAlgoFactory.dijkstra(PathExpanders.forTypeAndDirection(relationType, > Direction.OUTGOING), costEvaluator); > WeightedPath path = dijkstraPath.findSinglePath(startNode, endNode); > > > So, I can calculate the shortest route or the quickest route by > costProperty's value... > > Now, I need to make the same considerations, whit shortestPath algoritm, > because I would to retrieve the first N = 3 paths found. > > I tried using : > PathFinder<Path> simplePaths = > GraphAlgoFactory.shortestPath(PathExpanders.forTypeAndDirection(relationType, > Direction.OUTGOING), 1000000, 3); > Iterable<Path> paths = simplePaths.findAllPaths(startNode, endNode); > > but this not manage my "costProperty". > > Is there a way to retrieve the first N = 3 paths found, whit an algoritm that > manage "costProperty", like Dijkstra? > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to neo4j+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.