Hello,
I am trying to utilize the aStar routing method (took your advice, Rafal.
Thank you!!) within the GraphAlgoFactory. But I am not sure how to utilize
the "EstimateEvaluator".
In the JavaDocs under "Use"...I obtained the following example
*CommonEvaluators.**geoEstimateEvaluator<http://api.neo4j.org/current/org/neo4j/graphalgo/CommonEvaluators.htm...,
java.lang.String)>*(String<http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is...>
latitudePropertyKey,
String<http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is...>
longitudePropertyKey)
1) Do I need to use geoEstimateEvaluator? My Nodes already have lat/lon
properties in them. Do I simply pass the lat/lon for the endNode?
2) Also, am I using my Path variable ("route") properly? Will this return
the actual path that I can then iterate through and print?
So far, I have the following code for my method:
public void createRoute()
{
PathFinder<Path> finder = GraphAlgoFactory.aStar(
Traversal.expanderForTypes( RelTypes.OSM_NODENEXT,
Direction.BOTH) ,
CommonEvaluators.doubleCostEvaluator("distance_in_meters"),
EstimateEvaluator );
String startNodeID;
String endNodeID;
Path route;
startNodeID = JOptionPane.showInputDialog("Enter nodeID for the Start Node:
");
endNodeID = JOptionPane.showInputDialog("Enter nodeID for the End Node: ");
long startNode = Long.valueOf(startNodeID);
long endNode = Long.valueOf(endNodeID);
Node start = graphDb.getNodeById(startNode);
Node end = graphDb.getNodeById(endNode);
route = finder.findSinglePath(start, end);
}//end createRoute()
Thank you for any advice!