DEV Community

Cover image for What is Neo4j?
Sukhbir Sekhon
Sukhbir Sekhon

Posted on • Updated on

What is Neo4j?

Introduction

Neo4j is simply a database but unlike traditional databases that store data in rows, columns, and tables, Neo4j has a completely flexible structure. Most importantly, Neo4j saves the relationships that connect your data. With Neo4j, each data record or node contains direct pointers to all the nodes that it's connected to.

Alt Text

Alt Text

Let's say Dwight is friends with Jim, that Dwight node points directly to Jim through a stored relationship. This network of nodes connected by relationships is known as a graph.

Neo4j is referred to as a native graph database because it efficiently implements the property graph model down to the storage level. This means that the data is stored exactly as you whiteboard it, and the database uses pointers to navigate and traverse the graph. In contrast to graph processing or in-memory libraries, Neo4j also provides full database characteristics, including ACID transaction compliance, cluster support, and runtime failover – making it suitable to use graphs for data in production scenarios.

Benefit of using Neo4j

Most other databases, even more, recent node SQL types, don't save relationship data directly. They can figure out connections of course, but they usually do this by searching through a separate data structure called an index.

Alt Text

Note: You can also set up indexes for each column in SQL to retrieve data from those columns quicker.

This lookup process which has to be done repeatedly to find each connection is an expensive extra step that makes these databases inherently slower than Neo4j for relationship intensive queries. Neo4j avoids these index lookups because its native storage layer is a connected graph. This is why Neo4j is called a native graph database.

Neo4j is used to detect fraud, enhance artificial intelligence, manage supply chains, unify data silos, and much more.

Neo4j has some more exciting benefits:

1. Performance

Graph databases such as Neo4j perform better than relational (SQL) and non-relational (NoSQL) databases. The key is that, even though data queries increase exponentially, the performance of Neo4j does not drop, compared to what happens with relational databases such as MySQL.

Graph databases respond to inquiries by updating the node and the relationships of that search and not the whole of the complete graph. That optimizes the process.

2. Responsiveness

Neo4J has many advantages, but one is its responsiveness in managing data. If we wanted to push the boundaries of its abilities, we would have to exceed a total volume of 34 billion nodes (data), 34 billion relationships between these pieces of data, 68 billion of properties, and 32,000 types of relationships.

3. Flexibility and scalability

When developers of a company work with big data, they are looking for flexibility and scalability. Graph databases contribute a lot in this regard because when needs increase, the possibilities of adding more nodes and relationships to an existing graph are huge.

Why use Neo4j?

There are some great use cases for Neo4j. I would try to explain those use cases by comparing Neo4j with other traditional databases.

1. Fraud detection

Neo4j can discover patterns that would be difficult to detect with other DBs. Fraud networks have mechanisms for a crime that are not detectable with the linear analysis of data. But with a scalable analysis of the multiple relationships between data, this is much easier.

2. Data center management

Graph databases are the perfect antidote to the overwhelming growth in data. The large quantity of information, devices, and users mean that traditional technologies cannot handle so much data. The flexibility, performance, and scalability of Neo4j make it possible to manage, monitor, and optimize all types of physical and virtual networks despite a large amount of data.

3. Master Data Management Systems

Master data management is a real headache for companies. The creation of a centralized and reliable information system is always a complex issue. The ultimate goal is that every member of an organization uses the same formats and applications for data. This creates a working protocol that is usable by the rest.

Neo4j helps create such systems with speed, agility, performance, and all this without losing flexibility and scalability with data.

Some popular features of Neo4j

Neo4j is very popular among developers, architects, and DBAs because of:

Cypher, a declarative query language similar to SQL, but optimized for graphs.

Constant time traversals in big graphs for both depth and breadth due to efficient representation of nodes and relationships. Enables scale-up to billions of nodes on moderate hardware.

Flexible property graph schema that can adapt over time, making it possible to materialize and add new relationships later to shortcut and speed up the domain data when the business needs change.

Drivers for popular programming languages, including Java, JavaScript, .NET, Python, and many more.

Conclusion

Neo4j is an open-source, NoSQL, native graph database that provides ACID (Atomicity Consistency Isolation Durability) compliance to the developers for backend databases. It is definitely not something new because it's been available for the public since 2003. It is a native graph database because it efficiently implements the property graph model down to the storage level which is very powerful. So basically if you draw the data graph relationship on a whiteboard, you can implement that structure in the database using pointers. I have been excited about so many technologies in the past because they are mostly game changers but hands down this is the most exciting concept I have ever come across. I want to give a shoutout to my mentor and best friend Joshua Anderson for introducing me to Neo4j.

Let me know in the comments what do you guys think about Neo4j. Thanks for reading my blog and I really appreciate your time. It really means a lot.

I found something really interesting on internet. There is a TrumpWorld dataset created using Neo4j. You can check it out here. I am leaving an image of the dataset nest down below. It's so dope.

Alt Text

Get started with Neo4j: Tutorial

Check out my website: Sukhbir Sekhon

Top comments (0)