We live in a world of interwoven relationships where data doesn’t fit neatly into straight rows or tidy tables. Modeling our data in a graph allows us to build applications that reflect this connected reality and understand chaotic data sets without oversimplifying their complexities or losing track of meaningful connections.
You may not know it, but you’re already experiencing the benefits of this approach. When Facebook or Twitter presents you with suggestions for people to follow, Google Maps helps you find the fastest route, or LinkedIn shows you how you’re connected to another person, graph thinking is helping make those connections.
Graph concepts aren’t new, but advances in native graph databases are allowing developers to unleash their connective power in unprecedented ways. Part of this surge in popularity is due to the fact that engineers who adopt graph databases like Neo4j are able to get up and running quickly — people already view the world in terms of relationships, so thinking about databases in the same way can be surprisingly intuitive.
Companies are starting to agree that graph databases aren’t just a passing trend. Forrester Research reported that they will be used by more than 25 percent of enterprises by 2017. Of all the NoSQL data stores out there, native graph databases are perhaps the most disruptive and the least talked about. If you have a graph problem (and many companies do), you may need a graph solution.
Understanding Graph Databases
Relational databases store data in tables that can quickly add up and become cumbersome to search through. As a table grows larger, the amount of processing power needed to traverse it and find valuable connections increases exponentially.
Graph databases relieve this issue by storing data as a series of nodes connected by relationships. This makes relationships first-class citizens in the data model rather than inferring connections using special properties, such as foreign keys. Graph databases traverse relationships in real time and increase performance by a large margin over standard relational databases, making it easier and faster to solve network problems, identify relationships, and optimize pathways.
Using its own graph database, FlockDB, Twitter can better understand the relationships between its users at scale. This would be a Herculean task in a relational database, which needs to compare countless columns in multiple tables using a brute-force methodology.
Benefits of Building on Graph Databases
Graph databases allow engineers to understand the user in context without sacrificing scale, unlocking the potential of personalization. Here are two exciting new ways that graph databases are already helping personalize options for users:
- Movie recommendations are a fantastic example to illustrate how analyzing graph connections can yield incredible but intuitive results. In a movie recommendation app, quickly considering the many nuanced connections between two pieces of content in a native graph database allows you to generate a list of recommendations that reflect their shared traits. This approach can help two people find a movie to watch together.
- E-commerce sites can increase sales, especially when they work in real time. If you’ve ever used the Amazon, eBay, or Walmart websites, you’ve likely seen product recommendations pop up based on your search history or purchases made by other people with similar behavior. These “people also bought” recommendations are typically powered by collaborative filtering, which considers a broader data set to make predictions about people’s preferences.For example, let’s say you and I have similar interests and have enjoyed three of the same items. When you purchase a fourth that I’ve not yet seen, the program can suggest that I may want to purchase that item, too, based on our overlapping taste profiles.
Such recommendations seem simple, but they can actually be complex operations to perform in real time and at a large scale with a relational database — especially if you want to further filter or sort those results. Using a graph database, you can perform complex queries in seconds that would have taken hours or days in a traditional relational database, assuming it didn’t break the whole system.
Building a recommendation engine with a graph database is one of the easiest things a developer can do. Once you’ve tried it, you’ll wonder why you didn’t sooner. Not only is the user experience faster and more streamlined, but also the overall development timeline.
Graphs are the essential technology solution for anyone who wants to build applications that make real-time, real-world recommendations. I encourage every database administrator and developer to give it a try and find out why “graph database” is more than just a trendy buzzword.