Neo4j Reading data / performing shortest path calculations on stored data
Posted
by paddydub
on Stack Overflow
See other posts from Stack Overflow
or by paddydub
Published on 2010-05-27T08:15:33Z
Indexed on
2010/05/27
8:21 UTC
Read the original article
Hit count: 393
I'm using the Batch_Insert example to insert Data into the database
How can i read this data back from the database. I can't find any examples of how i do this.
public static void CreateData()
{
// create the batch inserter
BatchInserter inserter = new BatchInserterImpl( "var/graphdb", BatchInserterImpl.loadProperties( "var/neo4j.props" ) );
Map<String,Object> properties = new HashMap<String,Object>();
properties.put( "name", "Mr. Andersson" );
properties.put( "age", 29 );
long node1 = inserter.createNode( properties );
properties.put( "name", "Trinity" );
properties.remove( "age" );
long node2 = inserter.createNode( properties );
inserter.createRelationship( node1, node2, DynamicRelationshipType.withName( "KNOWS" ), null );
inserter.shutdown();
}
I would like to store 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 );
Dijkstra<Double> dijkstra = getDijkstra( graph, 0.0, "s", "e" );
What is the best method to store this kind data with 10000's of edges. Then run the Dijskra algorighm to find shortest path calculations using the stored graph data.
© Stack Overflow or respective owner