I am using the following code to find the shortest path between two nodes:

Iterable<Object> spath = orientGraph.getRawGraph().command(new OSQLSynchQuery<Object>( 
                "select shortestPath("+v1.getId()+","+v2.getId()+",'BOTH')"));

My problem is that I it needs too much time. My graph has 36,692 vertices and 367,662 edges and the query needs approximately 2 minutes. I use orientdb-1.6.2. My machine has a 2.3 Ghz CPU (i5), 4GB RAM and 320GB disk and I am running on Macintosh OSX Mavericks (10.9).

Note that I don't use any special configuration for my DB. I just open it with the following code:

orientGraph = new OrientGraph("plocal:"+orientDBDir);

Also my heap size is at 2GB.

Is there a way to boost up the procedure in terms of speed?

EDIT: I am trying to print the results with the following code

System.out.println(spath.iterator().next());

After some test I realised that the spate.iterator().next() line is the one that slows down the procedure. Why is that?

有帮助吗?

解决方案

Release 1.7-SNAPSHOT fixed this problem. Now from 2 minutes the same query returns in 0.1 seconds!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top