(Un)common Use Cases for Graph Databases

Michal Bachman

by Michal Bachman
· 3 min read

At GraphAware, we live and breathe Neo4j. For three years, we have been helping customers around the world embrace this amazing technology as a solution to many interesting problems. Mainstream applications of graphs, such as real-time recommendations, fraud detection, impact analysis, and graph-aided search, have been getting a lot of media attention.

In the run up to GraphConnect Europe 2016, we would like to illustrate that graphs are truly for everyone by going over some of the less obvious, though equally interesting and intellectually stimulating use cases that we have come across.

Rules Engines

Whether you’re a startup building a mobile application that will help people diagnose their medical condition, or a large retailer trying to decide which carrier to book a shipment with, you will need a computer program to interpret a set of potentially complex rules in order to determine an outcome, given a set of known initial conditions.

These rules will likely change too fast for the development teams to keep up, even in the most agile of environments. Moreover, it is typically the business, not the development teams, who define the rules. A data-driven, rather than code-centric approach is needed, where rules can be loaded from a database and interpreted at runtime. To achieve this, we believe there is no better data model than a graph.

Neo4j Rules Engine Model

The image above shows a simple set of rules and point-based outcomes to help decide whether a person should attend GraphConnect in London. This graph can be understood by people with very little technical background, who would be able to tell just by looking at it that a person should attend the conference if they live in London or are a frequent traveller, but not if they are under the age of 18 or uninterested in technology.

For a developer, it would be equally easy to develop a simple application that interprets these rules and provides a decision for any given input. With this in place, business logic can be changed by adding, removing, or updating rules directly in Neo4j. With a working graph-based rules engine like this, a business user can decide in microseconds which shipping route to take based on the characteristics of a package or which supplier to use based on the requirements of a customer.

Intelligence and Law Enforcement

Let us now take a look at another important, yet not often publicised use for graphs. Criminals, terrorists, and other “bad guys” have two things in common. The first one is that they pose a greater threat when they are organised, i.e., they form some sort of a network. The other one is that they leave traces of their activity, no matter how sophisticated they are.

Graph databases are a great tool for uncovering and investigating illegal or otherwise malicious activity for three main reasons. First, they are easy to query and navigate using the Cypher query language and available visualisation tools, even for non-developers. Second, they are very fast at analysing connected data. Hence, answers can be found very quickly in critical situations, such as during an ongoing terrorist attack. Finally, and perhaps most importantly, graphs help users discover the “unknown unknowns”.

Imagine you’re the investigator of a crime and all the clues you have are a credit card transaction and a car license plate. The first question you would most definitely want to answer first is whether these clues are in any way related and how. Without a graph database, you will have to start by enumerating all the ways these clues could be related. Even if you were able to do that, the resulting query would likely be very complicated.

In Neo4j, finding the answer could be as simple as this Cypher query:

MATCH p=(tx:Transaction {txId:'123abc'})-[*..10]-(c:Car {plate:'LOVE NE04J'})

Without any up front knowledge about how the two may be related, you could find out, for example, that the card was used to pay for a speeding fine for the car and that it belongs to Alice, the sister of Bob who owns the vehicle.

Neo4j Intelligence Query

See you at GraphConnect

There are a plethora of other compelling use cases. We have used graphs to design complex university curricula, analyse investment portfolio risks, audit systems, and even generate story lines that will appeal to an audience.

The possibilities of graphs are endless. Come meet us at GraphConnect to chat about how Neo4j can help you, no matter how niche your domain or particular problem is. As always, the GraphAware conference stand will be a lot of fun! We look forward to meeting you soon.

Share this blog post: