Graph Databases. What’s the Big Deal?

Continuing the analysis on semantics and data science, it’s time to talk about graph databases and what they have to offer us.

Introduction

Should we invest our precious time in learning a new way on ingesting, storing and analyzing data? With the touch on mathematics on graphs?

For me the answer was unsure when I started my investigation, but after a little while, my answer was:

Here in this article, I’ll discuss some ideas and concepts of graph databases, what they are, what are their advantages and how they can help us in our daily tasks.

Btw, I’m really tired of writing tons of JOINs and loooong queries to calculate the numbers of customers (and their average salary) who bought item X between January 2017 and October 2018 in the state Y and that has been a customer for longer than Z months. So everything that helps me, and I think a lot of people, in reducing this time, and making it easier and more intuitive, I’m in.

What is a graph?

There’s a problem in English when we talk about graphs (in Spanish we don’t have that problem). If you search for graph images online, this is what you will probably see:

But that’s not the kind of graph I want to talk about. When I talk about a graph here, this is what you should be picturing in your head:

I’m going to give two definitions of a graph. First the mathematical one, and then a more simplistic one.

According to Behzad and Chartrand:

A graph G is a finite, non-empty set V together with a (possibly empty) set E (disjoint from V) of two-element subsets of (distinct) elements of V. Each element of V is referred to as a vertex and V itself as the vertex set of G; the members of the edge set E are called edges. By an element of a graph we shall mean a vertex or an edge.

One of the most appealing features of graph theory lies in the geometric or pictorial aspect of the subject. Given a graph, it is often useful to express it diagrammatically, where by each element of the set is represented by a point in the plane and each edge by a line segment.

It is convenient to refer to such a diagram of G as G itself, since the sets V and E are easily discernible. In the figure bellow, a graph G is shown with vertex set V = {V1, V2, V3, V4} and edge set E = {V1V2, V1V3, V2V4, V3V4}

Copyright Favio Vázquez (you can use it of course)

As you can see the set V contains the number of vertex or points in the graph and E the relationships between them (read V1V2 like V1 is connected to V2).