Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-06-2021 07:55 AM
Hi all,
I have been working on finding links between users through referrals. The basic data that I have is a users node with a relationship "is_parent_of" between these set of users.
Graph looks like this :
I wanted to get the referral tree of a user. So my cypher query is this -
MATCH (c:Users)-[r:IS_PARENT_OF*]->(ref)
WITH DISTINCT c, size(r) as gen, ref
WITH c, gen, collect(ref.name) as referrals
ORDER BY gen ASC
RETURN c.name as Customer, collect({gen:gen, referrals:referrals}) as referrals
and the output is -
However in this I can only see a split of generations starting from the user itself to the nth generations of referrals from him.. However I want to see his previous generations/links of referrals too..like his parent id, his parentid's other referrals (his siblings), his parents parents id. also. Here above I only have generation 1 which is the set of users the user has referred. I want generation 0, -1, -2..-n
Can someone please help me with how i can achieve this? Also I want each generations to be in separate columns instead of this 1 cell..
All the sessions of the conference are now available online