I was woundering if it is possbile to detemine the direction (OUTBOUND/INBOUND) of the current path? in case of using the ANY direction?
Something like this:
LET outboundPaths = (
FOR v, e, p IN 1..depth ANY startNode GRAPH @graphName
//if (p.Direction == "OUTBOUND")
//rest of code
//if (p.Direction == "INBOUND")
//rest of code
)
p.Direction - There isn't a Direction property.
In order to support "ANY" this is what I've came up with:
LET direction = @direction // "OUTBOUND", "INBOUND", or "ANY"
LET outboundPaths = (direction == "OUTBOUND" OR direction == "ANY") ? (
FOR v, e, p IN 1..depth OUTBOUND startNode GRAPH @graphName
//rest of code
) : []
LET inboundPaths = (direction == "INBOUND" OR direction == "ANY") ? (
FOR v, e, p IN 1..depth INBOUND startNode GRAPH @graphName
//rest of code
) : []
LET allPaths = UNION(outboundPaths, inboundPaths)
The problems with my code is 1. double traverse 2. extra union step