Wednesday, June 19, 2013

Graph databases are NOT just one of the other NoSQL databases, which do provide system to store data, but does expresses relationships in most natural way. Below is how you represent relationship in graph:

(tom)-[likes]->(suzzan)
(suzzan)-[hates]->(richard)

() represents nodes
[] represents relationship

Graph is collection of nodes and edges, where nodes represents entities and edges represents relationships. In graph databases the relationships are the first class citizens and hence capturing data in form of graph, which is most intuitive way to express relational data. Graph database also lets one add properties to relationship and nodes and such graphs are called as property graphs.

Some of the expert says that while modeling a new application, consider using graph databases before NoSQL databases or RDBMS. Most of the times graph databases would come handy, else you can consider choosing other databases. Here are some of the domains where graph databases excel than any other databases:

1. Social Networking
2. Geospacial space
3. Recommendation system
4. Fraud detection
5. Computer networks...

and many more.

In all the above mentioned domains, relationships are first class citizens. For example if
you need to find friend-of-friend (fof) to nth degree, then graph databases performs times better than relational or any other document stores. Graph databases can help you find recommendations for your customers based on the buying habits of their friends, and that too in real time. Isn't it amazing, than to do lot of backend processing before providing recommendation. These are not only the reasons why Twitter and Facebook are using graph databases. Don't just believe me, google it out...

Neo Technologies have been working in the direction of graph databases for more than a decade and are the one behind the most popular graph database Neo4j. This database currently exposes data through its query language named Cypher, which is sql like and very easy to learn and excel. It also exposes Restful apis which provides user to access the database from your favorite language. Neo4j provides loads of tutorials, migration tools, drivers to leverage the benefits of Neo4j in your existing application and draw value out of it. Currently Neo4j scales well upto billions of nodes and relationship and outperforms relational and document store in many usecase scenarios. So don't wait and get your hand twiddling around it.

Wait for next post, where we will talk about Cypher & Neo4j restful apis and many handy examples...