Neo4j graph database with Cypher query language. Use for graph-based data.
Neo4j is a native graph database. It stores data as nodes and relationships, not tables or documents. It is essential for "connected data" problems where relationships are as important as the data itself.
-- Create nodes and relationships
CREATE (alice:Person {name: 'Alice'})
CREATE (bob:Person {name: 'Bob'})
CREATE (alice)-[:KNOWS {since: 2024}]->(bob);
-- Query friends of friends
MATCH (p:Person {name: 'Alice'})-[:KNOWS]->(friend)-[:KNOWS]->(fof)
RETURN fof.name;
The SQL of Graphs. It uses ASCII-art patterns (node)-[RELATIONSHIP]->(node).
In Neo4j, every node physically points to the next node. "Joins" are pre-computed pointers. Traversing 1 million relationships is O(1) per step, not O(Log N) like B-Trees.
Library for algorithms like PageRank, Louvain (Community Detection), and Path Finding.
Do:
[:REVIEWED {rating: 5, date: ...}]).:Person) to optimize scans.Don't:
(Justin Bieber)-[:FOLLOWED_BY]->(...)) hurts traversal performance.ByKey or Range, use a K-V store.