What is a Graph Database?
Estimated reading time: 10 minutes
Graphs occur everywhere in everyday life: your network of friends, the network of roads you drive on, and the supply chain of factories, ships, and roads that brought you the device you’re reading this on. While it might be easy to connect the dots on how most things can be shown as a graph, what makes a database a graph database? That is the question you will have the answer to in this blog post, but to put it simply: a graph consists of nodes, edges, and properties representing the relationships within data.
In this article, we will discuss:
- What is a graph?
- What is a graph database?
- Different types of graph databases.
- Graph database use cases.
What is a Graph?
A graph is a collection of nodes and edges where the edges describe the relationship between the nodes. Graphs exist across multiple domains including graph theory, analytics, and database models. These three separate entities support each other and allow for connection through the specific abilities of each.
According to Wikipedia, graph theory is:
In mathematics, graph theory is the study of graphs, which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of vertices (also called nodes or points) which are connected by edges (also called links or lines).
In computing, it is considered an abstract data type that is good at representing connections or relations – unlike the tabular data structures of relational database systems, which are very limited in expressing concerns.
Graph analytics is not a new tool but is historically underutilized in data and analytics. Graph analytics is the process of analyzing data stored within a graph database. Data Scientists and Engineers can use a graph database to process nodes and edges to understand the relationship between the data collected. We cover some examples of graph analytics in the use cases section.
A good metaphor for graphs is to think of nodes as circles and edges as lines or arcs. The terms node and vertex are used interchangeably here. Usually, vertices are connected by edges, making up a graph. Vertices don’t have to be connected at all, but they may also be connected with more than one other vertex via multiple edges. You may also find vertices connected to themselves, as shown above.
This database form is considered the next step for data and analytics to get the most out of their delivery. Graph databases give a way to organize and present data for use cases previously considered difficult to address appropriately.
A graph database lets users analyze large data sets that previously could have been associated with complex use cases. A graph database allows data to be stored, navigated, and displayed together instead of through separate databases. They are the gateway to empower developers to do graph analytics.
A graph database stores the data and its natural relationships as a graph of nodes and edges instead of disconnected rows and columns in a table.
Example of a Graph Database
We currently live in an era where it is simpler than ever to connect with friends, family, and peers through digital communication. Social Media and Social Networking is a great example to showcase what a graph database can do.
Imagine this: You create an Instagram account for the first time. One of the first tasks that Instagram will ask you to do is connect your Facebook account or phone contacts. This way, Instagram can instantly find initial first contacts for you to follow. You can use a graph database through these first connections to find mutual connections through your followers and suggest other users for you to follow. These suggestions can range from celebrities whom many of your connections follow to connections with whom you might only share one mutual link. A graph database will let you view common interests, which can also impact the content that the algorithm will place in your feed. For example, if you are a sports fan constantly interacting with NHL content,you can use a graph databased to pull other content related to the NHL to showcase in your feed.
Types of Graph Databases
With many different kinds of databases on the market, it is essential to understand what separates the databases from one another. One of the key takeaways from a graph database is that a graph database allows you to store data more visually and interactively. Compared to a relational database, a graph database will enable you to store data on an individual level, while a relational database stores data in predefined tables. With a graph database, you can view the relationship between the data on a more fine-tuned level than in relational databases.
COMPARING GRAPH NoSQL TO RELATIONAL
There are a few different types of graph models, including property graphs and RDF (Resource Description Framework) graphs, and a few different types are defined here. ArangoDB is a property graph meaning the data you store can have an associated human-readable property. ArangoDB goes one step further by allowing you to keep these labels on the nodes and edges of your graph data. This allows for thoughtful data modeling that is intuitive to query and closer to the real-world relationship among data.
Storing the data in this way allows for an easier understanding of the data points and creates a way to analyze complex data sets. A lot of data naturally fits into a graph, so visualizing it as a graph can offer valuable insights, compared to visualizing data across countless tables or disconnected collections of documents, as you would with other databases. This creates a flexible way of viewing and utilizing your data.
Flexibility allows graph databases to help solve more complex business needs for multiple industries.
Graph databases can be used for various use cases, including fraud detection, supply chain networking, and 360 customer view.
As our understanding of data and technology expands, so does how we store data. Traditionally, there had been different databases, including relational, document, and key-value. Graph databases have become the go-to database solution as data becomes more complex and use cases have a higher demand in complexity.
Use Cases for Graph Databases
As mentioned earlier on in this post, graph databases can be used for more complex use cases, including but not limited to fraud detection, supply chain networking, and 360 customer view. Other famous use cases for graph databases include social networking, recommendation engine, ai knowledge graphs, and network/operations management.
Fraud Detection is one of the most popular use cases with a graph database. Fraud Detection is monitoring data from customers, accounts, devices, locations, etc., to identify money laundering and mule money accounts. This allows companies to identify fraudulent activity and fraud rings using stolen or synthetic identities. An example of a Graph Database used in a fraud detection use case is a company or any financial institution that wants to prevent illegal activity from complex fraud rings. A graph database is a suitable solution as it decreases the time needed to process fraud detection queries against the database and delivers simple data visualizations to analysts. They also allow for removing false positives as real customers are waiting for the money (customer satisfaction and lost revenue). Fraud Detection is a great use case for a graph database as relational DBs are too slow and complex to query in real-time.
Supply Chain Management
According to CIPS, Supply Chain Management is the flow of goods and services from raw manufacturing to consumption by the consumer. This process requires an organization to have a network of suppliers (that serve as links in the chain) to move the product through each stage.
Supply chain management allows organizations to:
- Deliver more, quickly
- Ensure products are available
- Reduce quality issues
- Navigate returns easily
It is ultimately improving value for both the organization and the customers. A real-world application for supply chain management would be to detect the changes in consumer buying patterns, unpredictable costs for materials, warehousing and freight fraud, and counterfeit production of in-demand unstable supplier networks. A graph database can help with these use case examples through graph machine learning, which will help improve recommendations.
A recommendation engine is a way in which a product or service can recommend similar products/goods based on previous purchases by customers and the similarities between products. Recommendation engines are helpful to companies as they gain insight into customer shopping habits, allowing them to create a unique customer experience for each of their users, in turn having a higher retention rate.
A solid recommendation engine comes with a few challenges, but the three main challenges are:
- Computer-heavy queries
A graph database can help solve all three of these problems. Regarding speed, a graph database can quickly surface all relationships between the data because those are stored as vertices and are how the data is organized. A graph database can also introduce more data points and remove some “fuzziness” from the results. Queries are simplified as a graph database can look at multiple queries compared to a relational database.
360 Customer View
Another use case for graph databases is 360 Customer View. 360 Customer View is the ability to aggregate and collect data from many sources and collectively store this in one place. 360 Customer View allows a business/organization to better understand their customer interactions. One particular use case ArangoDB solved was when a company needed to integrate many data sources containing semi-related data in different structures.
For this use case, this company required a fast, seamless data store solution to deal with growing amounts of unstructured data in their BI application. They decided to go with ArangoDB because of AQL (ArangoDB Query Language), which is easy to use and allows you to combine data models in queries. Another reason was our Foxx Microservices and our performance and scalability within a clustered environment.
ArangoDB as a Graph Database
ArangoDB goes graph and beyond by being a native graph store that natively incorporates capabilities from other data models, including key-value, document, search, and more. The graph capabilities of ArangoDB are similar to a property graph database but add more flexibility in data modeling as vertices and edges are both full JSON documents.
Due to this natively integrated support, users can take the result of a JOIN operation, geospatial query, text search, or any other access pattern as a starting point for further graph analysis and vice versa – all in one query, if needed.
Interested in learning more? Download our Graph and Beyond White Paper
Supply Chain Management | CIPS. https://www.cips.org/knowledge/procurement-topics-and-skills/supply-chain-management/
Hear More from the Author
Get the latest tutorials, blog posts and news: