15.5. Invert relationship

We start with two nodes connected by a relationship

CREATE (f:Foo)-[rel:FOOBAR {a:1}]->(b:Bar)
apoc.refactor.invert.dataset

Now we want to invert the relationship direction

MATCH (f:Foo)-[rel:FOOBAR {a:1}]->(b:Bar) WITH id(rel) as id
MATCH ()-[r]->() WHERE id(r) = id
CALL apoc.refactor.invert(r) yield input, output RETURN *
apoc.refactor.invert.call
apoc.refactor.invert