# Neo4j — The Leading Native Graph Database > Neo4j is the leading native graph database, providing an ACID-compliant transactional backend for powerful graph queries via the Cypher query language. Used by NASA, eBay, Airbnb, and thousands of apps needing relationship-heavy data. ## Install Save as a script file and run: ## Quick Use ```bash # Docker docker run -d --name neo4j -p 7474:7474 -p 7687:7687 \ -e NEO4J_AUTH=neo4j/tokrepo12345 \ -v neo4j-data:/data \ neo4j:5-community # Browser UI at http://localhost:7474 # Bolt protocol at bolt://localhost:7687 ``` Cypher queries (via browser or cypher-shell): ```cypher // Create nodes and relationships CREATE (w:User { name: "William", role: "founder" }) CREATE (t:Product { name: "TokRepo" }) CREATE (w)-[:FOUNDED { year: 2025 }]->(t) // Query: who founded what MATCH (u:User)-[r:FOUNDED]->(p:Product) RETURN u.name, p.name, r.year // Find friends of friends (classic graph query) MATCH (me:User { name: "William" })-[:KNOWS*2]-(fof:User) WHERE fof.name <> "William" RETURN DISTINCT fof.name // Shortest path MATCH path = shortestPath((a:City { name: "Shenzhen" })-[*]-(b:City { name: "Beijing" })) RETURN path // Indexes CREATE INDEX user_name FOR (u:User) ON (u.name) ``` ## Intro Neo4j is the leading native graph database, providing a property graph model with ACID transactions, the declarative Cypher query language, and a high-performance graph storage engine. Founded in 2007 by Emil Eifrem. Used by NASA, Airbnb, eBay, Comcast, and thousands of apps where relationships between entities matter more than individual records. - **Repo**: https://github.com/neo4j/neo4j - **Stars**: 16K+ - **Language**: Java - **License**: GPLv3 (Community) / commercial (Enterprise) ## 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 ```yaml # 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 --- Source: https://tokrepo.com/en/workflows/0114235f-35f7-11f1-9bc6-00163e2b0d79 Author: Script Depot