Create random unique edges

4 views
Skip to first unread message

Cherie Pun

unread,
Jun 9, 2016, 7:49:54 AM6/9/16
to Neo4j
Hi, I am trying to figure out a way to create random unique edges in the graph. I have written the following query to create a relationship between two users, but count always return 1 whether a new relationship is created or not. 
Is there a way to determine whether there was an existing edge or a new one was created? Thanks!

MATCH (a:USERS), (b:USERS)
WHERE id(a)=params[0] AND id(b)=params[1]
CREATE UNIQUE (a) -[r:TRUST] -> (b)
RETURN count(*)
Reply all
Reply to author
Forward
0 new messages