If you have trust issues about random queries that deletes data from the DB you can do what I did.
First you might want to check if the selected relationships are really duplicates. This query will set a property willBeDeleted to true, so you can check if you really want to delete those.
match (a)-[r]->(b)
with a,b,type(r) as typ, tail(collect(r)) as coll
foreach(x in coll | set x.willBeDeleted=true)
Now you can check which relationships will be deleted actually.
match(a)-[r]-(b)
where r.willBeDeleted=true
return a, b, r
If you think the right relationships will be deleted, then you can execute this query to delete the duplicates.
match (a)-[r]->(b)
with a,b,type(r) as typ, tail(collect(r)) as coll
foreach(x in coll | delete x)
START
clause is unnecessary, right? It seems to work the same without it. – Leralerch