Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-12-2022 05:56 AM
Hi all. I am writing a query where I want to find all the possible paths between the start node and the end node.
eg: lets say there are 3 paths from start node 'a' to end node 'z' with multiple intermediate nodes and relationships.
Now, if there are 3 paths from a->z (eg: 1. a->p->n->z,
2. a->o->b->r->z,
3. a->z) then I want these 3 paths as the return output of this cypher query.
I have written the following query and using apoc.path.expandConfig:
12-12-2022 08:39 AM
If I understand correctly, you want only those paths that terminate on the 'end' nodes. If so, you can configure the expandConf to return only those paths that terminate on those nodes.
MATCH (start:User{Name:"xyz"})
match (end:Resource)
WITH start, collect(end) as tN
CALL apoc.path.expandConfig(start, {
uniqueness : 'RELATIONSHIP_PATH',
relationshipFilter : 'CanAccess|BelongsTo>|<isAttachedTo|Uses>',
terminatorNodes: tN
} )
yield path
return path
All the sessions of the conference are now available online