Note that there are some explanatory texts on larger screens.

plurals
  1. POfind the group in Neo4j graph db
    primarykey
    data
    text
    <p>I am using Neo4j for my project.</p> <p>In my graph DB I have 2 types of nodes:</p> <ol> <li>person</li> <li>fruit</li> </ol> <p>person nodes may be connected with each other with relation friend person nodes are connected with the nodes of fruits if they like that fruit.</p> <p>I want to find the set of group of 3 people who likes for example apple peach and orange and there is at least the path from one person to 3rd with relation "friend", or all 3 are friends.</p> <p>Since I have started using neo4j just recently, I need Guru's help to come up with solution.</p> <p>My though is: </p> <p>find out the group of people who likes apple find out the group of people who likes peach find out the group od people who likes orange</p> <p>from that 3 sets find out the existing node-rel-node-rel... path which starts in one of that sets goes through 2nd set end ends up in 3rd.</p> <p>Could you please confirm if my approach is correct and optimal and is it possible to implement via Cypher or py2neo?</p> <p>Couldn't find the way to share, but can paste the query here. If you paste it back to console.neo4j.org you will get a graph: </p> <p><code>CREATE (Neo { name:'Neo' }),(Morpheus { name: 'Morpheus' }),(Trinity { name: 'Trinity' }),(Cypher { name: 'Cypher' }),(Apple { fruit: 'Apple' }),(Peach { fruit: 'Peach' }),(Banana { fruit:'Banana' }), root-[:ROOT]-&gt;Neo, Neo-[:KNOWS]-&gt;Morpheus, Neo-[:KNOWS]-&gt;Trinity, Morpheus-[:KNOWS]-&gt;Cypher, Neo-[:LIKES]-&gt;Peach, Trinity-[:LIKES]-Banana, Morpheus-[:LIKES]-Apple</code> </p> <p>Assuming that you see the model in mentioned website. So here I need to search people who like (Peach, Banana, Apple) as a Result I want to get Neo, Trinity and Morpheus, because Neo likes peach, Trinity likes banana and Morpheus likes apple and they are connected somehow (Neo knows both Morpheus and Trinity, even tho Trinity doesn't know Morpheus).</p> <p>There gonna be 100K people in my DB and everyone connected with some people and with fruits they like. I want to proceed described search and get all possible matchings like Neo, Morpheus and Trinity. Hope this description much more clear.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload