Everyday Graphs

Graph Databases

It is often said that time and tide stand still for no one. The same can be said for the world of enterprise IT – with new technologies constantly disrupting the comfort levels of even the most forward-thinking IT departments. Within the database management industry, we’re in the midst of a revolution as professionals seek to unlock business value from data and its relationships, leading to the realisations that traditional SQL databases don’t handle data relationships well, and most NoSQL databases don’t handle data relationships at all.

While SQL databases have comprised the mainstay of enterprise IT departments for decades, they have increasingly given way to NoSQL solutions as data volumes and connections explode. It’s important to keep a discerning eye on so-called NoSQL databases; the term is sometimes considered irritatingly vague and is applied to wildly differing database types.

Several NoSQL database categories have emerged, each solving a distinct business problem: document, column array, key-value and graphs. While the whole NoSQL sector is gathering increasing attention, graph databases are generating real and lasting excitement, with interest for the sector having grown rapidly during the first five months of 2014.

Graphs, while building momentum in the sector, are still considered by some as a dark art, and difficult to understand. Nothing could be further from the truth. Graph databases are easily understood and used on a daily basis. If you’ve ever worked out a route via the tube map or followed a family tree, you have manually run your own graph-based query.

In fact, chances are you’ve come across a product or service powered by a graph database within the last few hours. Many everyday businesses have created new products and services and re-imagined existing ones, by bringing data relationships to the fore. That’s because graph databases are the best way to model, store, and query both data and its relationships, which is crucial for next-generation applications that feature real-time recommendations, graph-based search, identity and access management, and several other characteristics.

The Seven Bridges Puzzle

Graphs theory, far from being a recent data handling development, is actually nearly 300 years old and can be traced to Leonhard Euler, a Swiss mathematician. Euler was looking to solve an old riddle known as the ‘Seven Bridges of Königsberg’. Set on the Pregel River, the city of Königsberg included two large islands connected to each other and the mainland by seven bridges.

The challenge was to map a route through the city that would cross each bridge only once while ending at the starting point. Euler realised that by stripping the problem to its basics, eliminating all features except landmasses and the bridges connecting them, he could develop a mathematical structure that proved the riddle impossible. Today’s graphs are based entirely from Euler’s design – with land masses now referred to as a ‘node’ (or ‘vertex’), while the bridges are the ‘links’ (also known as ‘edges’).

Living Graphs

Framing the question in the physical world can help demonstrate why graph databases are a natural and intuitive way to organise data. The London Underground provides the perfect example: a series of stations (nodes) all connected by a specific set of relationships. The graph has fixed rules; you can’t simply teleport from one station to another but must follow the links. The way our minds work on the London Underground’s map is almost exactly the same way a graph database works. We zero in on the start and end points of our journey and then calculate the various possible routes between them.

Everyday Use

Graphs are also a vital part of our online lives, powering everything from social media sites – including Twitter and Facebook – as well as the recommendation functions within retailers such as Walmart and eBay. Online dating also owes much of its success to the way graphs can analyse even the most complex relationships, looking not only at location and personal details but also passions, hobbies and attitudes to identify potential matches. Enterprise efforts in fraud detection, master data management, and network and IT operations are vastly improving with graph database usage.

Interest in the graph is gathering pace for good reason. The fast and real-time nature of a graph database makes it an excellent platform for unlocking business value from data relationships, which simply can’t be carried out on traditional SQL or most NoSQL databases. And as you can see, it’s an intuitive way to model a database.

Emil Eifrem is founder of the Neo4j open source graph database project.