Cypher query to exlude subpaths (or return only full paths)
Hello all,
I have the following (simplified) scenario:
A -> [R] -> B B -> [R] -> C
where A, B, C are vertex of my graph, and R is a relation.
With the following query:
MATCH p = (t1)-[R*]->(t2)
the following paths are returned:
A -> B, B->C, A -> B -> C
Is it possible to build a query that returns only the following path: A -> B -> C?
I was thinking about
- adding a WHERE clause similar to "WHERE not t2 -> [R] -> ()"
- adding a MATCH similar to "MATCH NOT (p1 = (t2)-[R]->())"
but I'm not able to obtain a valid query...
Could you please me give any advice?
Thanx a lot in advance
@FrancescoSillani
Given your scenario, does this path A -> B -> C exist?
@FrancescoSillani
Assuming, your scenario is- A -> [R] -> B -> [R] -> C, please refer to the documentation on variable length edges. You can MATCH paths with exactly 2 edges using (t1)-[:R*2]->(t2).
This issue is stale because it has been open 45 days with no activity. Remove "Abondoned" label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for further 7 days with no activity.