Hello Folks,
Hi i have some basic question on data modeling.
I have a Person node which is holding so much details about Person e.g DoB,DoJ,Firstname,lastName, Education , Hobbies, Employment etc just like any Social media platform.
do i divide these info to nodes and relate to Person via outer Relations, or should i add those information into the Node Properties.
need your guidance on it.
generally speaking you want to limit fan-out of nodes unless you have a specific reason to do so:
- you need to build some hierarchy that will be used to filter the graph (like your Hobbies)
- you have one to many relationships that need to be modeled (like multiple emails for the same person)
Keep in mind that it is always faster to query through traversals rather than searching properties. A well constructed graph query will land on anchor nodes (that have labels and perhaps an indexed property to help identify it) and then follow local traversals along connected relationships to produce your result set.
When considering properties that have low cardinality ( eg gender), these are best modeled as labels rather than nodes with relationships, since modeling those type of properties as nodes would lead to dense nodes (a node with millions of relationships) that can slow down your graph queries. Neo4j has full support for set operations, so you can put more than one label on your nodes to help filter them quickly using set logic: (n:Customer:Female)
or (n:Customer) WHERE NOT n:Lapsed
The nice thing about graphs is that as the designer, you can experiment until you have something that works well for your use case.