[英]ShortestPath query is too slow with OrientDB
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.
我的图有36,692个顶点和367,662个边,查询大约需要2分钟。 I use orientdb-1.6.2.
我使用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).
我的机器有一个2.3 Ghz CPU(i5),4GB RAM和320GB磁盘,我在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. 我的堆大小也是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. 经过一些测试后,我意识到spate.iterator()。next()行是减慢程序速度的行。 Why is that?
这是为什么?
Release 1.7-SNAPSHOT fixed this problem. 发布1.7-SNAPSHOT解决了这个问题。 Now from 2 minutes the same query returns in 0.1 seconds!
现在从2分钟开始,相同的查询在0.1秒内返回!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.