2016-05-10 6 views
0

OrientDBを使用して2つのノード間の最短経路を探したいと思います。次のように私はそれを実装しました:OrientDBのショートパスが非常に遅い

String s = "select expand(ShortestPath(" + first_vertex.getId() + 
    ", " + second_vertex.getId() + ", "+ direction +") ) "; 

は、しかし非常に遅いのNeo4jと比較して、頂点のみ

 for (Vertex v : (Iterable<Vertex>) call_shortest_path.g.command(
       new OCommandSQL(s)).execute()) { 
     System.out.println(v.getProperty("name").toString()); 
     } 

それが動作する印刷します。改善の方法はありますか?私はそれがあなたのものよりも高速だかはわからないものの、

String s = "select shortestPath(" + first_vertex.getId() + ", " + second_vertex.getId() + ", "+ direction +") unwind shortestPath"; 

EDIT

これは私のために働いている:

+0

こんにちは、どのバージョンをお使いですか? thnx –

+0

What's Neo4jとの時間の違いは?あなたは2.2.0-rc1で試しましたか? – Lvca

+0

Neo4jバージョン2.3.3とOrientDBバージョン2.1.12を使用しています。時差は本当に素晴らしいです(Neo4j:50ミリ秒、OrientDBは170ミリ秒です)。与えられたノードの関係を検索する際、OrientDBははるかに高速ですが、短いパスを検索する場合はそうではありません。 – Questioner

答えて

0

は、クエリをこのように変更しようと

String s = "select expand (shortestPath) from (select shortestPath(" + first_vertex.getId() + ", " + second_vertex.getId() + ", " + direction + ") unwind shortestPath)"; 
+0

結果が返されません – Questioner

+0

あなたの更新のために回答 –

+0

を更新しました。しかし、それは私の最初の試み(134 MS)よりもさらに遅い(220 MS)。 – Questioner

関連する問題