I want to gain shortest path with weight(ex. length of link).
I'm trying dijkstra() function on OrientDB-1.7-rc2, but dijkstra() may not 
work.
This function parameter is Dijkstra(shource_RID, target_RID, 'weight', 
'direction').
Dijkstra() function work well on OrintDB-1.3.

*Insert java code :*
OrientGraph graph = new 
OrientGraph(plocal:/home/orientdb-community-1.7-rc2/databases/Network);
Vertex v1 = graph.addVertex(null);
Vertex v2 = graph.addVertex(null);
Vertex v3 = graph.addVertex(null);
Vertex v4 = graph.addVertex(null);
v1.setProperty("node_id", "A");
v2.setProperty("node_id", "B");
v3.setProperty("node_id", "C");
v4.setProperty("node_id", "D");
Edge e1 = graph.addEdge(null, v1, v2, "weight");
e1.setProperty("weight", 1.0f);
Edge e2 = graph.addEdge(null, v2, v3, "weight");
e2.setProperty("weight", 1.0f);
Edge e3 = graph.addEdge(null, v1, v3, "weight");
e3.setProperty("weight", 100.0f);
Edge e4 = graph.addEdge(null, v3, v4, "weight");
e4.setProperty("weight", 1.0f);
graph.commit();

*Select java code : *
OrientGraph graph = new 
OrientGraph(plocal:/home/orientdb-community-1.7-rc2/databases/Network);
Vertex from_vertex = graph.getVertices("node_id", "A").iterator().next();
Vertex to_Vertex = graph.getVertices("node_id", "D").iterator().next();
OSQLSynchQuery<T> sql_v = new OSQLSynchQuery<T>("select flatten(dijkstra) 
from (select dijkstra(" + from_vertex.getId().toString() + ", " + 
to_vertex.getId().toString() + ", 'weight'))");
List<ODocument> execute_v = db.query(sql_v);
for(ODocument od : execute_v) {
    System.out.println("vertex list : "+od.field("node_id"));
}

Right result is A->B->C->D on OrientDB 1.3
But result of OrientDB 1.7 is A->C->D

Is there bug in dijkstra() function?
 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to