4
votes

My Graph Looks like this:

A --1--> B --2--> C --3--> D

|
4
|
V

E

I want to get the shortest paths from A to D. But I do not want the vertices but the edges that make up the path.

From here I ended up with:

 select expand(shortestPath) from (select shortestPath(A, D).outE())

But the result does not only contain the correct answers 1, 2, 3 but also 4, so all outgoing edges from the vertices that make up the path.

  • How could I get only the edges that make up the shortest path?
  • What if there are several shortest paths, how can I get all of them?

It would be cool if I could select shortestpath or dijkstra as a traversal strategy. IMO this is where they belong.

1

1 Answers

-1
votes

OrientDB already has dijkstra function. Howerver to filter only the edges do:

select from (select expand( shortestPath(A, D) ) ) where @this instanceof 'E'