I have found a link which states to toggle the relationship:
MATCH (u:User) WHERE id(u) = 1 (p:Post) WHERE id(p) = 1 CREATE (u)-[:LIKES]->(p) WITH u, p MATCH (u)-[r:LIKES]->(p), (u)-[:LIKES]->(p) DELETE r
But I'm not able to understand how toggle is working here.
Also, when I tried to count the relationship, it returns 0 and 2 instead of 0 and 1. Why?
RETURN count(r) // returns 2 at first and 0 at second try