An Introduction to Graph Databases

Some of might have already heard about the Graph Databases, many of you might not have heard about it. But I am sure most of you reading this blog don’t have any idea about what a Graph Database is. And this is what we will be discussing in this blog post, An introduction to Graph Databases. First we will talk about briefly about what Graphs are, then we will move to how graphs appear in our day to day lives and then we will finally finish this blog by giving an introduction to graph databases. So let’s get started.

Introduction

In simple terms, a graph is just a set of nodes which are connected to each other via relationships. Nodes are also known as objects or vertices and relationships are also known as edges or links. A simple example of a graph is given in the figure below.

A simple example of a Graph
A Simple example of a Graph

As it can be clearly seen in the graph, there are a bunch of nodes, namely Elon Musk, SpaceX, California and South Africa. And there are a bunch of relationships that connect these nodes, namely Founded, Headquartered in and Born in. The figure therefore demonstrates what a simple graph looks like, however graphs can be much much more complex in reality with many more nodes and relationships, including many relationships between the same set of nodes, circular relationships and self relationships.

Now that we have an idea what graphs are, lets talk about how Graphs appear in our day to day lives.

Graphs in Everyday Lives

The fact that the above example is a part of real life demonstrates that graphs are a part of our day to day lives. Graphs are used in almost every aspect of our lives, whether be it social media such as facebook, instagram or linkedin, shortest route planning between 2 points, matching profiles on dating sites like tinder, scheduling school or university exams for everyone in the shortest amount of time, or the internet itself. However as a part of this blog, I will be taking just the example of social media.

Example of Social Media as a Simple Graph and an introduction to graph databases.
Example of Social Media as a Simple Graph

In the above example, of a social media site, I am following Elon Musk and Narendra Mode, and they both are following each other(In this example at least). But none of them is following me, which if they did would certainly make me happy. The above example nevertheless shows how the social media network of people can be represented as a graph, where each person is represented as a node, and each relationship defines how 2 nodes are connected, which in this case is if a node or person follows another node or person.

Introduction to Graph Databases

A Graph Database is a Database Management System, or simply a Database that uses the graph model for creating, reading, updating and deleting(often known as CRUD) information in the database. A database that uses a graph model for CRUD operations has some serious advantages over databases that use various other models for storing information. So, to put it simply, a graph database is database that stores information in the form on nodes and the relationship between them. The figure in the previous section could very well represent how a Graph Database stores information. However, more information can be stored in the nodes and relationships about themselves.

As discussed above, since most of the problems encountered in our day to day lives have a structure similar to graph, it only makes sense to use graph database to model this data. Also, since this type of database doesn’t have a schema, new data of various type can be added at a later point in time without altering the existing data. This abundance of flexibility and ability to model almost any type of relationships between nodes along with performance increase when dealing with connected data is what makes Graph Databases powerful over other types of databases.

Conclusion

So in this blog post about introduction to graph databases, we started with basics of graphs, and understood what are graphs. Then we talked about how graphs are abundant and appear in our day to day lives, and then at the last an introduction of graph databases was given. In the later blog post we will talk specifically about the various types of Graph Databases and how they are segregated along with the properties of graph databases.