Neo4J is a NoSQL is one of the most popular graph-oriented databases. Why is it so popular? What are the building blocks of Neo4J?

What is Neo4J?

Neo4J is a NoSQL Graph Database Management System (DBMS). It is originally developed in Java and accessible across all platforms. It respects the ACID properties. The graph schema is very flexible.

Neo4J allows requests through Cypher Query Language (CQL).

Key components

In a graph, the building blocks are :

  • a node
  • a relation
  • a label

A node contains the properties stored under a key-value format. The values stored might be :

  • numeric (integer, float)
  • string
  • boolean
  • list

A node cannot contain another node. There is no limit storage capacity.

A relation, also known as an edge, is used to connect two nodes. It can also store properties under the key-value principle, without any storage limit. A relation is always directed, from a node to the other.

A label is a name given to a set of nodes or relations. There is a limit at 64’000 different labels in the community edition of Neo4J, and 16’000’000 in the Enterprise edition. This is, however, an important point. Imagine a social network graph in which someone reached over 16 million followers. The ID of the follower could therefore not be used as the label… We’ll see later on how to manage this.

Relational Database vs. Graph Database

The first question you should ask is: “Why should I use a graph database ?”

Graph databases are quite specific and should be used only when needed. Among popular applications of Graph databases, you’ll find :

  • social networks
  • customer journey (rental services for example)
  • customer sessions
  • log anomaly detection

Conclusion : I hope this quick introduction to Neo4J was useful. Don’t hesitate to drop a comment if you have a question.