cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to call a procedure on multiple relationships at once?

Assuming that I have a list of relationships equally spaced from the centre of the graph (imagine the sun drawing), how can I call a procedure on all matched relationships at once?

I tried the following, but to no avail:

match p=(g:CenterNode {centre: 1})-[r:MINST2*2]-(leaf)
with collect(r) as rels
unwind rels as rel
call apoc.refactor.invert(rel)
1 REPLY 1

Binding a variable to a variable length pattern is deprecated. Use relationships of the path variable instead to get the relationships.

Do you have paths that have exactly two hops from a CenterNode and a leaf? If so, the following should work:

match p=(:CenterNode {centre: 1})-[:MINST2*2]->()
with relationships(p) as rels
unwind rels as rel
call apoc.refactor.invert(rel) yield input, output
return *