Hi there,
I hope some of you can help with an issue I an having .
I want to select a random starting node with maps to a random target node through a single specific relationship. I tried the following query but the target node is not random and when I add a distinct function to the target node it return and error.
MATCH (a)-[r:causes_f5plus]->(t:dsyn)
RETURN distinct(a.name), type(r), t.name, round(rand(), 10) as score
order by score
limit 50
/// this return random starting nodes but non-random target nodes.
I tried this and it return an error.
MATCH (n)-[r:causes_f5plus]->(m:dsyn)
RETURN distinct(n.name), type(r), distinct(m.name), round(rand(), 10) as score
order by score
limit 5
// but it return ..
Unknown function 'distinct' (line 2, column 35 (offset: 73))
"RETURN DISTINCT (n
).name
AS (n.name)
, type
((r
)) AS type(r)
, distinct
(((m
).name
)) AS distinct(m.name)
, round
((rand
()), (10)) AS score
I also tried collect(distinct(m.name)) and it is not random.
I wish some of you can lend some help.
by the way when I say non-random results I mean something like this
A-->j
J-->j
q-->j
x-->j
k-->j
I am looking from something like this where both the starting nodes and the target nodes are completely random.
J-->c
q-->u
x-->t
k-->a
your help is greatly appreciated.