Neo4j Performing shortest path calculations on stored data
I would like to store the following graph data in the database,
graph.makeEdge( "s", "c", "cost", (double) 7 );
graph.makeEdge( "c", "e", "cost", (double) 7 );
graph.makeEdge( "s", "a", "cost", 开发者_运维技巧(double) 2 );
graph.makeEdge( "a", "b", "cost", (double) 7 );
graph.makeEdge( "b", "e", "cost", (double) 2 );
Then run the Dijskra algorighm from a web servlet, to find shortest path calculations using the stored graph data. Then I will print the path to a html file from the servlet.
Dijkstra<Double> dijkstra = getDijkstra( graph, 0.0, "s", "e" );
I'm not sure what the actual question or problem is, could you clarify a bit?
There's a getting started guide that shows basic API usage for Neo4j. If you use it from Java, there's javadocs online. You probably want to index some property on the nodes to find them again, see indexing and indexing with batchinserter. Graph algorithms like Dijkstra are documented on the wiki. Does that help?
Update: I created a full example inspired by this question, located here: http://github.com/neo4j-examples/java-dijkstra. The example includes common Neo4j components and javadocs so it can be used as a starting point for learning more.
精彩评论