Skip to content

You are viewing a free preview of this lesson.

Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.

What is Neo4j

What is Neo4j

Neo4j is the world's leading graph database, purpose-built for storing, querying, and analysing highly connected data. Unlike traditional relational databases that use tables and joins, Neo4j stores data as nodes and relationships — making it natural and efficient to work with connected information.


A Brief History

  • 2007 — Neo4j development begins in Sweden, inspired by the limitations of relational databases for connected data
  • 2010 — Neo4j 1.0 released as an open-source graph database
  • 2012 — The Cypher query language is introduced, making graph queries accessible
  • 2016 — Neo4j 3.0 launches with clustering and the Bolt binary protocol
  • 2018 — Neo4j raises $80 million in Series E funding, the largest investment in database history at that time
  • 2022 — Neo4j 5.0 released with autonomous clustering and improved Cypher
  • Today — Neo4j powers thousands of applications across fraud detection, recommendation engines, knowledge graphs, and more

Graph Databases vs Relational Databases

Understanding the difference between graph and relational databases is fundamental:

Relational Databases

In a relational database, data lives in tables connected by foreign keys:

``` Users Table Orders Table Products Table +---------+------+ +----------+---------+ +-----------+--------+ | user_id | name | | order_id | user_id | | product_id| name | +---------+------+ +----------+---------+ +-----------+--------+ | 1 | Alice| | 101 | 1 | | 501 | Laptop | | 2 | Bob | | 102 | 2 | | 502 | Phone | +---------+------+ +----------+---------+ +-----------+--------+ ```

To find "products purchased by friends of Alice," you need multiple joins across several tables — and performance degrades as data grows.

Graph Databases

In Neo4j, the same data is represented as nodes connected by relationships:

``` (Alice)-[:FRIENDS_WITH]->(Bob) (Alice)-[:PURCHASED]->(Laptop) (Bob)-[:PURCHASED]->(Phone) ```

Finding "products purchased by friends of Alice" is a natural traversal — no joins required, and performance remains constant regardless of total data size.


Key Differences

Feature Relational Database Graph Database (Neo4j)
Data model Tables, rows, columns Nodes, relationships, properties
Connections Foreign keys + JOINs Direct relationships
Query performance on connected data Degrades with JOINs Constant time traversal
Schema Rigid, predefined Flexible, evolve as needed
Query language SQL Cypher
Best for Structured, tabular data Connected, relationship-rich data

When to Use Neo4j

Neo4j excels when relationships are as important as the data itself:

Use Case Example
Fraud detection Identify suspicious transaction rings and shared identities
Recommendation engines "People who bought X also bought Y"
Knowledge graphs Connect concepts, documents, and entities for intelligent search
Network and IT operations Map dependencies between servers, services, and applications
Identity and access management Model complex permission hierarchies
Supply chain Track parts, suppliers, and logistics relationships
Social networks Model friendships, follows, and interactions

Neo4j Editions

Edition Description
Neo4j Community Edition Free, open-source, single-instance graph database
Neo4j Enterprise Edition Commercial licence with clustering, security, and advanced features
Neo4j AuraDB Fully managed cloud graph database (free tier available)
Neo4j AuraDS Managed graph data science platform in the cloud

The Neo4j Ecosystem

Neo4j provides a rich ecosystem of tools:

Tool Purpose
Neo4j Browser Web-based interface for running Cypher queries and visualising results
Neo4j Desktop Local development environment with project management
Neo4j Bloom Business-friendly graph visualisation and exploration
Neo4j Data Importer Visual tool for importing CSV data into Neo4j
APOC Library of hundreds of useful stored procedures and functions
Graph Data Science (GDS) Library of graph algorithms for analytics
Neo4j Drivers Official drivers for JavaScript, Python, Java, .NET, and Go

The Property Graph Model

Neo4j uses the property graph model, which consists of:

  1. Nodes — entities (people, products, places)
  2. Relationships — connections between nodes (always directed, always have a type)
  3. Properties — key-value pairs on both nodes and relationships
  4. Labels — tags on nodes for categorisation (a node can have multiple labels)

``` (:Person {name: "Alice", age: 30})-[:WORKS_AT {since: 2020}]->(:Company {name: "Acme"}) ```


Summary

Neo4j is a graph database designed for connected data. It stores information as nodes and relationships rather than tables and foreign keys, enabling efficient traversal of complex data networks. With its intuitive property graph model, the Cypher query language, and a rich ecosystem of tools, Neo4j is the go-to choice for applications where relationships drive value — from fraud detection to recommendation engines. In the next lesson, we will explore graph data modelling in depth.