What Neo4j Does
- Property graph — nodes, relationships, both with properties
- Cypher — SQL-like declarative query language (now ISO GQL standard)
- Index-free adjacency — constant-time traversal regardless of graph size
- ACID transactions — full consistency guarantees
- Clustering — Enterprise causal clustering for HA
- Graph algorithms — via Graph Data Science (GDS) library
- Vector search — Neo4j 5.11+ built-in vector indexes for RAG
- GraphQL — Neo4j GraphQL library to generate API
Architecture
Native graph storage: nodes and relationships are first-class records on disk with direct pointers (index-free adjacency). Query engine compiles Cypher to an execution plan that walks the graph. Bolt binary protocol for driver communication.
Self-Hosting
# docker-compose.yml
version: "3"
services:
neo4j:
image: neo4j:5-community
ports: ["7474:7474", "7687:7687"]
volumes:
- neo4j-data:/data
- neo4j-logs:/logs
environment:
NEO4J_AUTH: neo4j/tokrepo12345
NEO4J_server_memory_heap_max__size: 2G
NEO4J_PLUGINS: "[\"apoc\", \"graph-data-science\"]"
volumes:
neo4j-data:
neo4j-logs:Key Features
- Native property graph storage
- Cypher query language
- ACID transactions
- Graph Data Science library (65+ algorithms)
- Vector indexes for AI/RAG
- Neo4j Browser UI
- Bolt binary protocol
- APOC stored procedures library
- Causal clustering (Enterprise)
- Fabric for multi-database queries
Comparison
| Graph DB | Query Lang | Type | Storage |
|---|---|---|---|
| Neo4j | Cypher | Property graph | Native |
| ArangoDB | AQL | Multi-model | Native |
| JanusGraph | Gremlin | Property graph | Cassandra/HBase |
| TigerGraph | GSQL | Property graph | Native |
| Dgraph | DQL + GraphQL | RDF-like | Native |
| Memgraph | Cypher | Property graph | In-memory |
| NebulaGraph | nGQL | Property graph | Distributed |
常见问题 FAQ
Q: 什么场景选图数据库? A: 社交网络、推荐系统、欺诈检测、知识图谱、依赖分析、身份认证链——任何以关系为核心的查询。
Q: Cypher vs Gremlin? A: Cypher 声明式(SQL-like),Gremlin 命令式(像程序)。Cypher 更易读、已成为 ISO GQL 标准;Gremlin 更通用(任何 TinkerPop 图)。
Q: 向量搜索? A: Neo4j 5.11+ 支持原生向量索引,可以把向量和图结构结合做 GraphRAG——图节点同时带 embedding。
来源与致谢 Sources
- Docs: https://neo4j.com/docs
- GitHub: https://github.com/neo4j/neo4j
- License: GPLv3 Community / commercial Enterprise