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!