Hi there
We are using Neo4j 2.0.3 in order to build a routing system. We are using
the classical A Start implementation, tough we saw that there is a
TraversalAstar implementation but it seems to be in experimental status yet.
By the way, we read an OSM file and create our graph; actually we have
around 1 million of points. around 2 million of relationships and around 5
million of properites on relationships; by reading neo4j documentation it
seems to me that this DB dimension is really small and it's really well
handled by neo4j but in my case this doesn't seem to be real (maybe I'm
missing something)
Actually our node creation code is the following one:
private long createGraphNode(OsmNodeWrapper osmNodeWrapper)
{
try
{
Map<String, Object> nodeProps = new HashMap<String, Object>();
double x = osmNodeWrapper.getLongitude();
double y = osmNodeWrapper.getLatitude();
nodeProps.put(OSMAttribute.LATITUDE_PROPERTY, y);
nodeProps.put(OSMAttribute.LONGITUDE_PROPERTY, x);
nodeProps.put(OSMAttribute.OSM_NODE_ID_PROPERTY, osmNodeWrapper.
getOsmNodeId());
if (osmNodeWrapper.isTrafficSignal())
nodeProps.put(OSMAttribute.TRAFFIC_SIGNAL, true);
// Creo il nodo
long graphNodeId = inserter.createNode(nodeProps, mainNodeLabel);
// aggiungo l'identificativo del nodo sul grafo
osmNodeWrapper.setGraphNodeId(graphNodeId);
return graphNodeId;
}
In our graph, we have only 2 types of relationships:
- *CAR_ONE_WAY_RELATION* for one way road with Direction OUTCOMING
- *CAR_BIDIRECTIONAL_WAY_RELATION* for bidirectional road with Direction
BOTH
This is the relationship creation code:
//Create RelationShip
Map<String, Object> relationProps = new HashMap<String, Object>();
relationProps.put(OSMAttribute.EDGE_LENGTH_PROPERTY, lunghezzaArco);
....//other properties
long relId = inserter.createRelationship(startNode, endNode,
"CAR_ONE_WAY_RELATION", relationProps);
osmWayIdPropertyIndex.add(relId, relationProps)
We configured the neo4j embedded by using the following parameters:
neostore.nodestore.db.mapped_memory=100M
neostore.relationshipstore.db.mapped_memory=3G
neostore.propertystore.db.mapped_memory=100M
neostore.propertystore.db.strings.mapped_memory=200M
neostore.propertystore.db.arrays.mapped_memory=50M
cache_type=strong
As you can see we use a strong cache type; this means we cache all data in
memory. Moreover when out application starts we load all nodes and
properties in memory; n order to do this we use this code:
private void loadWholeGraphInMemory() throws PinfGraphServiceException{
StopWatch sw = new StopWatch();
sw.start();
Node start;
for ( Node n : ggo.getAllNodes() ) {
n.getPropertyKeys();
for ( Relationship relationship : n.getRelationships() ) {
start = relationship.getStartNode();
}
}
for ( Relationship r : ggo.getAllRelationships() ) {
start = r.getStartNode();
r.getPropertyKeys();
}
sw.stop();
logger.info("Grafo caricato in "+sw.getLastTaskTimeMillis()+" millis");
}
We tried to execute the AStar algorithm between 2 points. The distance
between points is around 130 kilometers. In order to execute the algorithm
Neo4j takes around 4 seconds for returning a path and it seems to me really
too much; if i compare it to other software on the same OSM I have really
really really really different performance.
Is there any way to improve the Algorithm performance? Where can we act to
have better performance? would be better to use the Traversal AStar?
Moreover is there any plan to implement bi-directional AStar and/or
Dijkstra?
I guess that with this kind of perfomance, Neo4j is not suitable for my
scenario
Thank you
Angelo
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.