Product recommendations - how to compose query?

#1

Hi,
could you please suggest how to write such query?

I have vertices Customer; Alex, John, Paul
And edges ‘Bought’; Alex-[Bought]->Notebook, John-[Bought]->Notebook, John-[Bought]->Printer, Paul-[Bought]->Notebook, John-[Bought]->Paper

I’d like to know what else bought customers that purchased ‘Notebook’.

Could you please help me with that?
Regards

#2

Hi @Gosforth

You can easily do it with a MATCH:

MATCH
{class:Product, as:product, where:(name='Notebook')}  <-Bought- {as:customer, class:Customer} -Bought-> {as:something, where:($matched.product != $currentMatch)}
RETURN  customer.name, something.name

Thanks

Luigi

1 Like
#3

Thank you very much!