Justin Swartsel
Justin Swartsel

Reputation: 3431

OrientDB SQL - how to traverse path based on weight?

Let's say we have a simple graph stored in OrientDB, with an edge type called weightedEdge that has a property weight. I'd like to be able to traverse from a starting node to an arbitrary depth, but only traverse to nodes that have the maximum value of weight on their incoming edge compared to all other edges at the same depth. Is this possible using OrientDB SQL?

enter image description here

So in the given example above, I would only want to hop along the red arrows.

Thank you!

Upvotes: 3

Views: 409

Answers (1)

pembeci
pembeci

Reputation: 705

May be you can use a let block and then property selection via [ ]:

traverse out()[weight = $maxW] ...
LET $maxW = SELECT max(weight) FROM ...

Upvotes: 1

Related Questions