Pages

Neo4j Graph Database | Design tips

One thing I learned from working using Neo4j graph database is that we need to avoid replication as much as possible in graph database. Replication could lead to a log of inconsistency and could be the reason of a lot of problems.(or maintenance issue).

We were using graph database to represent the logical progression of states of let's say a smart phone. The phone is in certain state, which means, the phone has certain set of module hardwares, and those hardwares are running certain set of softwares to help us properly use the smartphone.


Now various things could happen that would lead to the change in the state of the smartphone. Some of the scenarios are as follows.

  • There is a software update issued by the vendor for some modules.
  • There is a software that is added/replaced
  • A hardware could be changed on a service center
  • The user may choose to install/uninstall a software in his phone
  • The user may subscribe for some paid service in his phone
  • etc
Any of the above would lead to the change in state of the smartphone.
Now there could be various constraints among those modules/hardwares and softwares. Some require certain version of other to run smoothly.

Say all these state change were saved in a central database somewhere in the cloud. 

You may want to consider these if you are designing a graph model for this type of data.


  • Represent one unique entity with only one node in the database. Don't create two or more nodes of same type and exact same values.
  • Use the edges for relationship and put any additional information pertaining to the relationship in the same edge
There's not much. These are the most important things you need to consider. Then think about which properties you want to put in a node, which in a relationship. You can also create some virtual nodes with some unique properties to support your relationship.

1 comment:

  1. They offer a more conversational tone, often engaging readers with comments and discussions. NordVPN 3 Years Deal In contrast, articles are typically more structured and objective, presenting factual information and analysis on a specific topic.

    ReplyDelete

If you like to say anything (good/bad), Please do not hesitate...