Reputation: 192
I am using the following neo4j cypher query on my graph:
MATCH (start:N1{id:'xyz'})
CALL apoc.path.expandConfig(start, {sequence:'N1, a>, N2, b>, N3, c>,
N4', maxLevel:3}) YIELD path
RETURN path
ORDER BY length(path) DESC
Now I want to keep N3 as optional. Like if the link N2-b->N3 is unavailable, it should then check for N2-b->N4 and so on. I know I can do two separate queries and check. But is there a way to keep N3 optional in this query itself?
Thanks in advance!
Upvotes: 0
Views: 177
Reputation: 30397
No, this currently isn't possible. If there was a different node to use instead this would work, as you could accept a different label in place of the node (or any node label if you didn't care), but there isn't a way to use the sequences here where the number of nodes/rels in the defined sequence isn't constant.
Upvotes: 1